| //===----------------------------------------------------------------------===// |
| // The LLVM Compiler Infrastructure |
| // This file is dual licensed under the MIT and the University of Illinois Open |
| // Source Licenses. See LICENSE.TXT for details. |
| //===----------------------------------------------------------------------===// |
| // UNSUPPORTED: c++98, c++03, c++11, c++14 |
| // constexpr const T& optional<T>::value() const &; |
| using std::bad_optional_access; |
| constexpr int test() const & {return 3;} |
| constexpr int test() const && {return 5;} |
| int test() && {return 6;} |
| const optional<X> opt; ((void)opt); |
| ASSERT_NOT_NOEXCEPT(opt.value()); |
| ASSERT_SAME_TYPE(decltype(opt.value()), X const&); |
| constexpr optional<X> opt(in_place); |
| static_assert(opt.value().test() == 3, ""); |
| const optional<X> opt(in_place); |
| assert(opt.value().test() == 3); |
| #ifndef TEST_HAS_NO_EXCEPTIONS |
| catch (const bad_optional_access&) |