gcc/testsuite/g++.dg/cpp1y/lambda-generic-107437.C
raw| 1 | // PR c++/107437 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | |
| 4 | struct integral_constant { |
| 5 | constexpr operator int() const { return 42; } |
| 6 | }; |
| 7 | |
| 8 | template<int N> |
| 9 | struct A { |
| 10 | static constexpr int value = N; |
| 11 | }; |
| 12 | |
| 13 | template<class T> |
| 14 | void f(T t) { |
| 15 | [=](auto) { |
| 16 | A<t> a; // { dg-bogus "constant" } |
| 17 | return a.value; |
| 18 | }(0); |
| 19 | } |
| 20 | |
| 21 | template void f(integral_constant); |