| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fdiagnostics-show-caret" } */ |
| 3 |
|
| 4 |
void test_1 (signed char e); |
| 5 |
|
| 6 |
/* PR c/70339. */ |
| 7 |
void test_2 (singed char e); // { dg-error "6: 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; did you mean 'signed'\\?" "" { target *-*-* } 7 } |
| 13 |
/* { dg-begin-multiline-output "" } |
| 14 |
void test_2 (singed char e); |
| 15 |
^~~~~~ |
| 16 |
signed |
| 17 |
{ dg-end-multiline-output "" } */ |
| 18 |
|
| 19 |
void test_3 (car e); // { dg-error "6: variable or field 'test_3' declared void" } |
| 20 |
/* { dg-begin-multiline-output "" } |
| 21 |
void test_3 (car e); |
| 22 |
^~~~~~ |
| 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 "" } |
| 26 |
void test_3 (car e); |
| 27 |
^~~ |
| 28 |
char |
| 29 |
{ dg-end-multiline-output "" } */ |
| 30 |
|
| 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); |
| 35 |
^ |
| 36 |
{ dg-end-multiline-output "" } */ |
| 37 |
|
| 38 |
/* Verify that we handle misspelled typedef names. */ |
| 39 |
|
| 40 |
typedef struct something {} something_t; |
| 41 |
|
| 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 "" } |
| 44 |
some_thing_t test_5; |
| 45 |
^~~~~~~~~~~~ |
| 46 |
something_t |
| 47 |
{ dg-end-multiline-output "" } */ |
| 48 |
|
| 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; |
| 53 |
^~~~~~ |
| 54 |
{ dg-end-multiline-output "" } */ |
| 55 |
|
| 56 |
typedef long int64_t; |
| 57 |
int64 i; // { dg-error "1: 'int64' does not name a type; did you mean 'int'?" } |
| 58 |
/* { dg-begin-multiline-output "" } |
| 59 |
int64 i; |
| 60 |
^~~~~ |
| 61 |
int |
| 62 |
{ dg-end-multiline-output "" } */ |
| 63 |
|
| 64 |
/* Verify that gcc doesn't offer nonsensical suggestions. */ |
| 65 |
|
| 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 "" } */ |
| 72 |
|
| 73 |
singed char ch; // { dg-error "1: 'singed' does not name a type; did you mean 'signed'?" } |
| 74 |
/* { dg-begin-multiline-output "" } |
| 75 |
singed char ch; |
| 76 |
^~~~~~ |
| 77 |
signed |
| 78 |
{ dg-end-multiline-output "" } */ |