Debian Codegraph @

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

raw
1 // PR c++/69516
2 // { dg-do compile { target c++14 } }
3
4 constexpr int
5 foo (int n)
6 {
7 __extension__ int a[n] = { 1, 2, 3, 4, 5, 6 }; // { dg-error "array subscript" }
8 int z = 0;
9 for (int i = 0; i <= n; ++i)
10 z += a[i];
11 return z;
12 }
13
14 constexpr int n = foo (3); // { dg-message "in .constexpr. expansion of " }