aboutsummaryrefslogtreecommitdiffstats
path: root/gcc-4.9/gcc/testsuite/g++.dg/cpp1y/vla4.C
blob: 9de1d28fef1c0df7afb547d92e9b41eb6129baf9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
// Test for range-based for with VLAs.
// { dg-do run { target c++1y } }

#include <new>

void f(int i)
{
  int ar[i];
  int j = 0;
  for (int& x : ar)
    x = ++j;
  [&ar]{
    int k = 0;
    for (int x : ar)
      if (x != ++k)
	__builtin_abort();
  }();
}

int main()
{
  f(42);				// OK
}