Debian Codegraph @

gcc/testsuite/g++.dg/cpp2a/lambda-uneval18.C

raw
1 // PR c++/116714
2 // PR c++/107390
3 // { dg-do compile { target c++20 } }
4
5 template<class T, class U>
6 inline constexpr bool is_same_v = __is_same(T, U);
7
8 template<class T, class U>
9 struct is_same { static constexpr bool value = false; };
10
11 template<class T>
12 struct is_same<T, T> { static constexpr bool value = true; };
13
14 template<class>
15 void f() {
16 using type = decltype([]{});
17 static_assert(is_same_v<type, type>);
18 static_assert(is_same<type, type>::value);
19 };
20
21 template<class>
22 void g() {
23 using ty1 = decltype([]{});
24 using ty2 = ty1;
25 static_assert(is_same_v<ty1, ty2>);
26 static_assert(is_same<ty1, ty2>::value);
27 };
28
29 template<class>
30 void h() {
31 using ty1 = decltype([]{});
32 using ty2 = decltype([]{});
33 static_assert(!is_same_v<ty1, ty2>);
34 static_assert(!is_same<ty1, ty2>::value);
35 };
36
37 template void f<int>();
38 template void g<int>();
39 template void h<int>();