PR c++/56973, DR 696 - capture constant variables only as needed.
[official-gcc.git] / gcc / testsuite / g++.dg / cpp1y / vla2.C
blob07c300884a37ef43ab248dbed22a3a4d1b0c813e
1 // N3639 allows initialization and capture of VLAs
2 // { dg-do run { target c++11 } }
3 // { dg-options "-Wno-vla" }
5 void f(int n)
7   int ar[n] = { 42 };
8   auto l = [&] { return ar[0]; };
9   if (l() != 42) __builtin_abort ();
12 int main()
14   f(1);