1 //===----------------------------------------------------------------------===//
3 // The LLVM Compiler Infrastructure
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // XFAIL: libcpp-no-exceptions
13 // constexpr const T& optional<T>::value() const;
15 #include <experimental/optional>
16 #include <type_traits>
19 #if _LIBCPP_STD_VER > 11
21 using std::experimental::optional;
22 using std::experimental::in_place_t;
23 using std::experimental::in_place;
24 using std::experimental::bad_optional_access;
30 constexpr int test() const {return 3;}
31 int test() {return 4;}
34 #endif // _LIBCPP_STD_VER > 11
38 #if _LIBCPP_STD_VER > 11
40 constexpr optional<X> opt(in_place);
41 static_assert(opt.value().test() == 3, "");
44 const optional<X> opt(in_place);
45 assert(opt.value().test() == 3);
48 const optional<X> opt;
54 catch (const bad_optional_access&)
58 #endif // _LIBCPP_STD_VER > 11