1 //===----------------------------------------------------------------------===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 // UNSUPPORTED: c++03, c++11, c++14
12 // constexpr T& optional<T>::operator*() &;
15 #include <type_traits>
18 #include "test_macros.h"
24 constexpr int test() const& {return 3;}
25 int test() & {return 4;}
26 constexpr int test() const&& {return 5;}
27 int test() && {return 6;}
32 constexpr int test() {return 7;}
45 optional
<X
> opt
; ((void)opt
);
46 ASSERT_SAME_TYPE(decltype(*opt
), X
&);
47 ASSERT_NOEXCEPT(*opt
);
51 assert((*opt
).test() == 4);
53 static_assert(test() == 7, "");