aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/ext/constexpr-vla4.C
blob: 428a8fd5224a4f626c8422a7434c23b4f77bcccd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
// PR c++/70452
// { dg-do compile { target c++14 } }

constexpr int
foo (int n, bool p)
{
  __extension__ int a [n] = { 0 };
  if (n == 3)
    foo (n - 2, false);
  if (n == 3)
    foo(n - 1, true);
  if (p)
    return a[1];
  return 0;
}

constexpr int i2 = foo (3, false); // { dg-bogus "array subscript out of bound" }