blob: aff1d21a4b7badbe288fd42576e93b13946e472b [file] [log] [blame]
// PR c++/69496
// { dg-do compile { target c++14 } }
constexpr int
fn_ok (int n)
{
__extension__ int a[n] = { };
int z = 0;
for (unsigned i = 0; i < sizeof (a) / sizeof (int); ++i)
z += a[i];
return z;
}
constexpr int
fn_not_ok (int n)
{
__extension__ int a[n] = { };
int z = 0;
for (unsigned i = 0; i < sizeof (a); ++i)
z += a[i];
return z;
}
constexpr int n1 = fn_ok (3);
constexpr int n2 = fn_not_ok (3); // { dg-error "array subscript|in .constexpr. expansion of " }