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; did you mean 'signed'\\?" "" { target *-*-* } 7 }
13 /* { dg-begin-multiline-output "" }
14 void test_2 (singed char e);
17 { dg-end-multiline-output "" } */
19 void test_3 (car e); // { dg-error "14: variable or field 'test_3' declared void" }
20 /* { dg-begin-multiline-output "" }
23 { dg-end-multiline-output "" } */
24 // { dg-message "14: 'car' was not declared in this scope; did you mean 'char'\\?" "" { target *-*-* } 19 }
25 /* { dg-begin-multiline-output "" }
29 { dg-end-multiline-output "" } */
31 /* TODO: this one could be handled better. */
32 void test_4 (signed car e); // { dg-error "25: expected ',' or '...' before 'e'" }
33 /* { dg-begin-multiline-output "" }
34 void test_4 (signed car e);
36 { dg-end-multiline-output "" } */
38 /* Verify that we handle misspelled typedef names. */
40 typedef struct something {} something_t;
42 some_thing_t test_5; // { dg-error "1: 'some_thing_t' does not name a type; did you mean 'something_t'?" }
43 /* { dg-begin-multiline-output "" }
47 { dg-end-multiline-output "" } */
49 /* TODO: we don't yet handle misspelled struct names. */
50 struct some_thing test_6; // { dg-error "aggregate 'some_thing test_6' has incomplete type and cannot be defined" }
51 /* { dg-begin-multiline-output "" }
52 struct some_thing test_6;
54 { dg-end-multiline-output "" } */
57 int64 i; // { dg-error "1: 'int64' does not name a type; did you mean 'int64_t'?" }
58 /* { dg-begin-multiline-output "" }
62 { dg-end-multiline-output "" } */
64 /* Verify that gcc doesn't offer nonsensical suggestions. */
66 nonsensical_suggestion_t var; /* { dg-bogus "did you mean" } */
67 /* { dg-error "'nonsensical_suggestion_t' does not name a type" "" { target { *-*-* } } .-1 } */
68 /* { dg-begin-multiline-output "" }
69 nonsensical_suggestion_t var;
70 ^~~~~~~~~~~~~~~~~~~~~~~~
71 { dg-end-multiline-output "" } */
73 singed char ch; // { dg-error "1: 'singed' does not name a type; did you mean 'signed'?" }
74 /* { dg-begin-multiline-output "" }
78 { dg-end-multiline-output "" } */