Mercurial > hg > CbC > CbC_gcc
annotate gcc/testsuite/g++.dg/cpp1y/vla4.C @ 131:84e7813d76e9
gcc-8.2
author | mir3636 |
---|---|
date | Thu, 25 Oct 2018 07:37:49 +0900 |
parents | 04ced10e8804 |
children |
rev | line source |
---|---|
111 | 1 // Test for range-based for with VLAs. |
2 // { dg-do run { target c++11 } } | |
3 // { dg-options "-Wno-vla" } | |
4 | |
5 #include <new> | |
6 | |
7 void f(int i) | |
8 { | |
9 int ar[i]; | |
10 int j = 0; | |
11 for (int& x : ar) | |
12 x = ++j; | |
13 [&ar]{ | |
14 int k = 0; | |
15 for (int x : ar) | |
16 if (x != ++k) | |
17 __builtin_abort(); | |
18 }(); | |
19 } | |
20 | |
21 int main() | |
22 { | |
23 f(42); // OK | |
24 } |