* gcc.dg/stack-check-5.c: Skip with -fstack-protector.
[official-gcc.git] / gcc / testsuite / gcc.dg / diagnostic-range-static-assert.c
blob6f75476deb3660c790204410ff9a05fcd1c87122
1 /* { dg-options "-fdiagnostics-show-caret" } */
3 void test_nonconst_static_assert (int param)
5 int local = 0;
7 _Static_assert (param > 0, "message"); /* { dg-error "expression in static assertion is not constant" } */
8 /* { dg-begin-multiline-output "" }
9 _Static_assert (param > 0, "message");
10 ~~~~~~^~~
11 { dg-end-multiline-output "" } */
13 _Static_assert (param, "message"); /* { dg-error "expression in static assertion is not constant" } */
14 /* { dg-begin-multiline-output "" }
15 _Static_assert (param, "message");
16 ^~~~~
17 { dg-end-multiline-output "" } */
19 _Static_assert (local, "message"); /* { dg-error "expression in static assertion is not constant" } */
20 /* { dg-begin-multiline-output "" }
21 _Static_assert (local, "message");
22 ^~~~~
23 { dg-end-multiline-output "" } */