1 /* { dg-options "-fdiagnostics-show-caret" } */
3 /* A sequence of bogus _Static_assert.
4 We can offer fix-it hints for some of these, but not all. */
6 void test_static_assert_1 (void)
8 _Static_assert
sizeof(int) >= sizeof(char); /* { dg-error "expected '\\(' before 'sizeof'" } */
9 /* { dg-begin-multiline-output "" }
10 _Static_assert sizeof(int) >= sizeof(char);
13 { dg-end-multiline-output "" } */
16 void test_static_assert_2 (void)
18 _Static_assert(sizeof(int) >= sizeof(char); /* { dg-error "expected '\\)' before ';' token" } */
19 /* { dg-begin-multiline-output "" }
20 _Static_assert(sizeof(int) >= sizeof(char);
23 { dg-end-multiline-output "" } */
26 void test_static_assert_3 (void)
28 _Static_assert(sizeof(int) >= sizeof(char),; /* { dg-error "expected string literal before ';' token" } */
29 /* { dg-begin-multiline-output "" }
30 _Static_assert(sizeof(int) >= sizeof(char),;
32 { dg-end-multiline-output "" } */
35 void test_static_assert_4 (void)
37 _Static_assert(sizeof(int) >= sizeof(char), "msg"; /* { dg-error "expected '\\)' before ';' token" } */
38 /* { dg-begin-multiline-output "" }
39 _Static_assert(sizeof(int) >= sizeof(char), "msg";
42 { dg-end-multiline-output "" } */
45 /* The final one is correct. */
47 void test_static_assert_5 (void)
49 _Static_assert(sizeof(int) >= sizeof(char), "msg");