| 1 |
// RUN: %clang_cc1 -std=c++20 -verify %s |
| 2 |
|
| 3 |
// expected-no-diagnostics |
| 4 |
|
| 5 |
namespace P1937R2 { |
| 6 |
struct N { |
| 7 |
constexpr N() {} |
| 8 |
N(N const&) = delete; |
| 9 |
}; |
| 10 |
|
| 11 |
template<typename T> constexpr void bad_assert_copyable() { T t; T t2 = t; } |
| 12 |
using ineffective = decltype(bad_assert_copyable<N>()); |
| 13 |
|
| 14 |
template<typename T> consteval void assert_copyable() { T t; T t2 = t; } |
| 15 |
// Prior to P1937R2 consteval functions were evaluated even in otherwise |
| 16 |
// unevaluated context, now this is well-formed. |
| 17 |
using check = decltype(assert_copyable<N>()); |
| 18 |
|
| 19 |
template<typename T> |
| 20 |
__add_rvalue_reference(T) declval(); |
| 21 |
|
| 22 |
constexpr auto add1(auto lhs, auto rhs) { |
| 23 |
return lhs + rhs; |
| 24 |
} |
| 25 |
using T = decltype(add1(declval<int>(), declval<int>())); |
| 26 |
|
| 27 |
consteval auto add2(auto lhs, auto rhs) { |
| 28 |
return lhs + rhs; |
| 29 |
} |
| 30 |
using T = decltype(add2(declval<int>(), declval<int>())); |
| 31 |
} // namespace P1937R2 |
| 32 |
|