| //===----------------------------------------------------------------------===// |
| // 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 T& optional<T>::value() &&; |
| using std::bad_optional_access; |
| constexpr int test() const & {return 3;} |
| constexpr int test() const && {return 5;} |
| int test() && {return 6;} |
| constexpr int test() && {return 7;} |
| return std::move(opt).value().test(); |
| optional<X> opt; ((void)opt); |
| ASSERT_NOT_NOEXCEPT(std::move(opt).value()); |
| ASSERT_SAME_TYPE(decltype(std::move(opt).value()), X&&); |
| assert(std::move(opt).value().test() == 6); |
| #ifndef TEST_HAS_NO_EXCEPTIONS |
| catch (const bad_optional_access&) |
| static_assert(test() == 7, ""); |