Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / expr / expr.const / p8-2a.cpp
blobc13b32a165dbd8083a7e77679e7650dd094fbbf0
1 // RUN: %clang_cc1 -std=c++20 -verify %s
3 // expected-no-diagnostics
5 namespace P1937R2 {
6 struct N {
7 constexpr N() {}
8 N(N const&) = delete;
9 };
11 template<typename T> constexpr void bad_assert_copyable() { T t; T t2 = t; }
12 using ineffective = decltype(bad_assert_copyable<N>());
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>());
19 template<typename T>
20 __add_rvalue_reference(T) declval();
22 constexpr auto add1(auto lhs, auto rhs) {
23 return lhs + rhs;
25 using T = decltype(add1(declval<int>(), declval<int>()));
27 consteval auto add2(auto lhs, auto rhs) {
28 return lhs + rhs;
30 using T = decltype(add2(declval<int>(), declval<int>()));
31 } // namespace P1937R2