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 "14: unknown type name .singed.; did you mean .signed.?" } */
8 /* { dg-begin-multiline-output "" }
9 void test_2 (singed char e);
12 { dg-end-multiline-output "" } */
14 void test_3 (car e
); /* { dg-error "14: unknown type name .car.; did you mean .char.?" } */
15 /* { dg-begin-multiline-output "" }
19 { dg-end-multiline-output "" } */
21 /* TODO: this one could be handled better. */
22 void test_4 (signed car e
); /* { dg-error "25: before .e." } */
23 /* { dg-begin-multiline-output "" }
24 void test_4 (signed car e);
26 { dg-end-multiline-output "" } */
28 /* Verify that we handle misspelled typedef names. */
30 typedef struct something
{} something_t
;
32 some_thing_t test_5
; /* { dg-error "1: unknown type name .some_thing_t.; did you mean .something_t.?" } */
33 /* { dg-begin-multiline-output "" }
37 { dg-end-multiline-output "" } */
39 /* TODO: we don't yet handle misspelled struct names. */
40 struct some_thing test_6
; /* { dg-error "storage size of .test_6. isn't known" } */
41 /* { dg-begin-multiline-output "" }
42 struct some_thing test_6;
44 { dg-end-multiline-output "" } */
47 int64 i
; /* { dg-error "unknown type name 'int64'; did you mean 'int64_t'?" } */
48 /* { dg-begin-multiline-output "" }
52 { dg-end-multiline-output "" } */
54 /* Verify that gcc doesn't offer nonsensical suggestions. */
56 nonsensical_suggestion_t var
; /* { dg-bogus "did you mean" } */
57 /* { dg-error "unknown type name" "" { target { *-*-* } } .-1 } */
58 /* { dg-begin-multiline-output "" }
59 nonsensical_suggestion_t var;
60 ^~~~~~~~~~~~~~~~~~~~~~~~
61 { dg-end-multiline-output "" } */
64 /* In the following, we should suggest inserting "struct" (rather
65 than "did you mean 'float'") and provide a fixit hint. */
69 foo_t
*foo_ptr
; /* { dg-error "1: unknown type name .foo_t.; use .struct. keyword to refer to the type" } */
70 /* { dg-begin-multiline-output "" }
74 { dg-end-multiline-output "" } */
77 /* Similarly for unions. */
82 bar_t
*bar_ptr
; /* { dg-error "1: unknown type name .bar_t.; use .union. keyword to refer to the type" } */
83 /* { dg-begin-multiline-output "" }
87 { dg-end-multiline-output "" } */
90 /* Similarly for enums. */
95 baz value
; /* { dg-error "1: unknown type name .baz.; use .enum. keyword to refer to the type" } */
96 /* { dg-begin-multiline-output "" }
100 { dg-end-multiline-output "" } */
102 /* TODO: it would be better to detect the "singed" vs "signed" typo here. */
103 singed
char ch
; /* { dg-error "7: before .char." } */
104 /* { dg-begin-multiline-output "" }
108 { dg-end-multiline-output "" } */