gcc/testsuite/g++.dg/cpp1y/lambda-vla1.C
raw| 1 | // PR c++/90732 |
| 2 | // { dg-do compile { target c++14 } } |
| 3 | // { dg-additional-options "-Wno-vla" } |
| 4 | |
| 5 | /*const*/ int SIZE = 100; |
| 6 | |
| 7 | template<typename T> |
| 8 | int foo(T t) { |
| 9 | char buf[SIZE] = { 24 }; |
| 10 | return [&buf](auto x){ return buf[x]; }(t); |
| 11 | } |
| 12 | |
| 13 | int main() { |
| 14 | if (foo(0) != 24) |
| 15 | __builtin_abort(); |
| 16 | } |