Implement P0315R4, Lambdas in unevaluated contexts.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp2a / lambda-uneval6.C
blob0396f9ff10d48a9a4adc650d0f23d91f222b5cf9
1 // { dg-do compile { target c++2a } }
3 static decltype([] { }) f();
4 static decltype([] { }) f(); // { dg-error "ambiguating" }
6 static decltype([] { }) g();
7 static decltype(g()) g(); // okay
9 static void h(decltype([] { }) *) { }
10 static void h(decltype([] { }) *) { }
11 void x1() { h(nullptr); } // { dg-error "ambiguous" }
13 using A = decltype([] { });
14 static void i(A *);
15 static void i(A *) { }
16 void x2() { i(nullptr); } // okay
18 template <typename T>
19 using B = decltype([] { });
20 static void j(B<char16_t> *) { }
21 static void j(B<char32_t> *) { }
22 void x3() { j(nullptr); } // { dg-error "ambiguous" }
24 template <int N> static void k(decltype([]{ return 0; }()));
25 template <int N> static void k(decltype([]{ return 0; }())); // okay
26 template <int N> static void k(int); // okay