Nullopt and InPlace should be structs, not enum values
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jan 2016 21:32:12 +0000 (21:32 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 8 Jan 2016 21:32:12 +0000 (21:32 +0000)
commit56feaa85d246280394782cd257ede34ffff7d23c
tree9d68198dd9e8145a15cd5eb11496bac666a0791f
parent4d68a8e316588d194426f3b5137911e514b15319
Nullopt and InPlace should be structs, not enum values
https://bugs.webkit.org/show_bug.cgi?id=152915

Reviewed by Andreas Kling.

Without this,

Optional<int> o = flag ? 1 : Nullopt;

would cause Nullopt to be treated as an integer, causing o to be initialized to 0,
instead of Nullopt. With this change, the above code now causes a compile error.

Also, get rid of the CONSTEXPR macro since all compilers support constexpr properly,
and add a WTF::makeOptional to match the current iteration of std::experimental::optional.

* wtf/Compiler.h:
* wtf/Forward.h:
* wtf/Optional.h:
(WTF::NulloptTag::NulloptTag):
(WTF::makeOptional):
* wtf/StdLibExtras.h:
(std::literals::chrono_literals::operator _s):
(std::literals::chrono_literals::operator _ms):
(std::move):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@194784 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/wtf/Compiler.h
Source/WTF/wtf/Forward.h
Source/WTF/wtf/Optional.h
Source/WTF/wtf/StdLibExtras.h