annotate gcc/testsuite/g++.dg/ext/constexpr-vla2.C @ 131:84e7813d76e9

gcc-8.2
author mir3636
date Thu, 25 Oct 2018 07:37:49 +0900
parents 04ced10e8804
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
111
kono
parents:
diff changeset
1 // PR c++/69509
kono
parents:
diff changeset
2 // { dg-do compile { target c++14 } }
kono
parents:
diff changeset
3
kono
parents:
diff changeset
4 constexpr int
kono
parents:
diff changeset
5 fn_bad (int n)
kono
parents:
diff changeset
6 {
kono
parents:
diff changeset
7 __extension__ int a [n] = { 0 };
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
8 int z = a [0] + (n ? fn_bad (n - 1) : 0); // { dg-message "in .constexpr. expansion of " }
111
kono
parents:
diff changeset
9 return z;
kono
parents:
diff changeset
10 }
kono
parents:
diff changeset
11
kono
parents:
diff changeset
12 constexpr int
kono
parents:
diff changeset
13 fn_ok (int n)
kono
parents:
diff changeset
14 {
kono
parents:
diff changeset
15 __extension__ int a [n] = { 0 };
kono
parents:
diff changeset
16 int z = a [0] + (n > 1 ? fn_ok (n - 1) : 0);
kono
parents:
diff changeset
17 return z;
kono
parents:
diff changeset
18 }
kono
parents:
diff changeset
19
kono
parents:
diff changeset
20 constexpr int i1 = fn_ok (3);
131
84e7813d76e9 gcc-8.2
mir3636
parents: 111
diff changeset
21 constexpr int i2 = fn_bad (3); // { dg-error "array subscript|in .constexpr. expansion of " }