Debian Codegraph @

gcc/testsuite/g++.dg/ext/constexpr-vla4.C

raw
1 // PR c++/70452
2 // { dg-do compile { target c++14 } }
3
4 constexpr int
5 foo (int n, bool p)
6 {
7 __extension__ int a [n] = { 0 };
8 if (n == 3)
9 foo (n - 2, false);
10 if (n == 3)
11 foo(n - 1, true);
12 if (p)
13 return a[1];
14 return 0;
15 }
16
17 constexpr int i2 = foo (3, false); // { dg-bogus "array subscript out of bound" }