PR c++/86728 - C variadic generic lambda.
[official-gcc.git] / gcc / testsuite / g++.dg / spellcheck-typenames.C
blob01bcf78781e8bf5471bce4f6e79ef039126ac430
1 /* { dg-do compile } */
2 /* { dg-options "-fdiagnostics-show-caret" } */
4 void test_1 (signed char e);
6 /* PR c/70339.  */
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);
10                      ^~~~
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);
15               ^~~~~~
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);
20               ^~~~~~
21               signed
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 "" }
26  void test_3 (car e);
27               ^~~
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 "" }
32  void test_3 (car e);
33               ^~~
34               char
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);
41                          ^
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 "" }
50  some_thing_t test_5;
51  ^~~~~~~~~~~~
52  something_t
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;
59                    ^~~~~~
60    { dg-end-multiline-output "" } */
62 typedef long int64_t;
63 int64 i; // { dg-error "1: 'int64' does not name a type; did you mean 'int64_t'?" }
64 /* { dg-begin-multiline-output "" }
65  int64 i;
66  ^~~~~
67  int64_t
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 "" }
81  singed char ch;
82  ^~~~~~
83  signed
84    { dg-end-multiline-output "" } */