gcc/testsuite/g++.dg/cpp1z/constexpr-lambda24.C
raw| 1 | // PR c++/87327 |
| 2 | // { dg-do compile { target c++17 } } |
| 3 | |
| 4 | template <int N> |
| 5 | struct Foo { |
| 6 | constexpr auto size() const { |
| 7 | return N; |
| 8 | } |
| 9 | }; |
| 10 | |
| 11 | constexpr int foo() { |
| 12 | constexpr auto a = Foo<5>{}; |
| 13 | |
| 14 | [&] { |
| 15 | Foo<a.size()> it = {}; |
| 16 | |
| 17 | return it; |
| 18 | }(); |
| 19 | |
| 20 | return 42; |
| 21 | } |
| 22 | |
| 23 | constexpr int i = foo(); |