gcc/testsuite/g++.dg/cpp2a/concepts-lambda18.C
raw| 1 | // PR c++/103706 |
| 2 | // { dg-do compile { target c++20 } } |
| 3 | |
| 4 | template<class T, class U> concept C = __is_same(U, int); |
| 5 | |
| 6 | template<class T> void f() { |
| 7 | []() -> C<T> auto { |
| 8 | C<T> auto x = T(); // { dg-error "constraints" } |
| 9 | return T(); // { dg-error "constraints" } |
| 10 | }(); |
| 11 | } |
| 12 | |
| 13 | template void f<int>(); // { dg-bogus "" } |
| 14 | template void f<char>(); // { dg-message "required from here" } |