1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-show-caret" } */
4 void test_1 (signed char e);
7 void test_2 (singed char e); // { dg-error "21: variable or field 'test_2' declared void" }
8 /* { dg-begin-multiline-output "" }
9 void test_2 (singed char e);
11 { dg-end-multiline-output "" } */
12 // { dg-message "14: 'singed' was not declared in this scope" "" { target *-*-* } 7 }
13 /* { dg-begin-multiline-output "" }
14 void test_2 (singed char e);
16 { dg-end-multiline-output "" } */
17 // { dg-message "14: suggested alternative: 'signed'" "" { target *-*-* } 7 }
18 /* { dg-begin-multiline-output "" }
19 void test_2 (singed char e);
22 { dg-end-multiline-output "" } */
24 void test_3 (car e); // { dg-error "14: variable or field 'test_3' declared void" }
25 /* { dg-begin-multiline-output "" }
28 { dg-end-multiline-output "" } */
29 // { dg-message "14: 'car' was not declared in this scope" "" { target *-*-* } 24 }
30 // { dg-message "14: suggested alternative: 'char'" "" { target *-*-* } 24 }
31 /* { dg-begin-multiline-output "" }
35 { dg-end-multiline-output "" } */
37 /* TODO: this one could be handled better. */
38 void test_4 (signed car e); // { dg-error "25: expected ',' or '...' before 'e'" }
39 /* { dg-begin-multiline-output "" }
40 void test_4 (signed car e);
42 { dg-end-multiline-output "" } */
44 /* Verify that we handle misspelled typedef names. */
46 typedef struct something {} something_t;
48 some_thing_t test_5; // { dg-error "1: 'some_thing_t' does not name a type; did you mean 'something_t'?" }
49 /* { dg-begin-multiline-output "" }
53 { dg-end-multiline-output "" } */
55 /* TODO: we don't yet handle misspelled struct names. */
56 struct some_thing test_6; // { dg-error "aggregate 'some_thing test_6' has incomplete type and cannot be defined" }
57 /* { dg-begin-multiline-output "" }
58 struct some_thing test_6;
60 { dg-end-multiline-output "" } */
63 int64 i; // { dg-error "1: 'int64' does not name a type; did you mean 'int64_t'?" }
64 /* { dg-begin-multiline-output "" }
68 { dg-end-multiline-output "" } */
70 /* Verify that gcc doesn't offer nonsensical suggestions. */
72 nonsensical_suggestion_t var; /* { dg-bogus "did you mean" } */
73 /* { dg-error "'nonsensical_suggestion_t' does not name a type" "" { target { *-*-* } } .-1 } */
74 /* { dg-begin-multiline-output "" }
75 nonsensical_suggestion_t var;
76 ^~~~~~~~~~~~~~~~~~~~~~~~
77 { dg-end-multiline-output "" } */
79 singed char ch; // { dg-error "1: 'singed' does not name a type; did you mean 'signed'?" }
80 /* { dg-begin-multiline-output "" }
84 { dg-end-multiline-output "" } */