comparison gcc/testsuite/gcc.dg/missing-symbol-3.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 /* { dg-options "-fdiagnostics-show-caret" } */
2
3 /* A sequence of bogus _Static_assert.
4 We can offer fix-it hints for some of these, but not all. */
5
6 void test_static_assert_1 (void)
7 {
8 _Static_assert sizeof(int) >= sizeof(char); /* { dg-error "expected '\\(' before 'sizeof'" } */
9 /* { dg-begin-multiline-output "" }
10 _Static_assert sizeof(int) >= sizeof(char);
11 ^~~~~~
12 (
13 { dg-end-multiline-output "" } */
14 }
15
16 void test_static_assert_2 (void)
17 {
18 _Static_assert(sizeof(int) >= sizeof(char); /* { dg-error "expected ',' before ';' token" } */
19 /* { dg-begin-multiline-output "" }
20 _Static_assert(sizeof(int) >= sizeof(char);
21 ^
22 ,
23 { dg-end-multiline-output "" } */
24 }
25
26 void test_static_assert_3 (void)
27 {
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),;
31 ^
32 { dg-end-multiline-output "" } */
33 }
34
35 void test_static_assert_4 (void)
36 {
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";
40 ~ ^
41 )
42 { dg-end-multiline-output "" } */
43 }
44
45 /* The final one is correct. */
46
47 void test_static_assert_5 (void)
48 {
49 _Static_assert(sizeof(int) >= sizeof(char), "msg");
50 }