| 1 |
/* { dg-options "-fdiagnostics-show-caret" } */ |
| 2 |
|
| 3 |
/* Adapted from https://gcc.gnu.org/wiki/ClangDiagnosticsComparison */ |
| 4 |
|
| 5 |
typedef float __m128; |
| 6 |
void test_1 () |
| 7 |
{ |
| 8 |
__m128 myvec[2]; |
| 9 |
int const *ptr; |
| 10 |
myvec[1]/ptr; /* { dg-error "invalid operands to binary /" } */ |
| 11 |
|
| 12 |
/* TODO: ideally we'd underline "ptr" as well. |
| 13 |
{ dg-begin-multiline-output "" } |
| 14 |
myvec[1]/ptr; |
| 15 |
~~~~~~~~^ |
| 16 |
| |
| 17 |
__m128 |
| 18 |
{ dg-end-multiline-output "" } */ |
| 19 |
|
| 20 |
|
| 21 |
} |
| 22 |
|
| 23 |
struct s {}; |
| 24 |
struct t {}; |
| 25 |
extern struct s some_function (void); |
| 26 |
extern struct t some_other_function (void); |
| 27 |
|
| 28 |
int test_2 (void) |
| 29 |
{ |
| 30 |
return (some_function () |
| 31 |
+ some_other_function ()); /* { dg-error "invalid operands to binary \+" } */ |
| 32 |
|
| 33 |
/* { dg-begin-multiline-output "" } |
| 34 |
return (some_function () |
| 35 |
~~~~~~~~~~~~~~~~ |
| 36 |
| |
| 37 |
struct s |
| 38 |
+ some_other_function ()); |
| 39 |
^ ~~~~~~~~~~~~~~~~~~~~~~ |
| 40 |
| |
| 41 |
struct t |
| 42 |
{ dg-end-multiline-output "" } */ |
| 43 |
} |
| 44 |
|
| 45 |
int test_3 (struct s param_s, struct t param_t) |
| 46 |
{ |
| 47 |
return param_s + param_t; // { dg-error "invalid operands to binary \+" } |
| 48 |
|
| 49 |
/* { dg-begin-multiline-output "" } |
| 50 |
return param_s + param_t; |
| 51 |
^ |
| 52 |
{ dg-end-multiline-output "" } */ |
| 53 |
/* TODO: ideally we'd underline both params here. */ |
| 54 |
} |
| 55 |
|
| 56 |
typedef struct s S; |
| 57 |
typedef struct t T; |
| 58 |
|
| 59 |
extern S callee_4a (void); |
| 60 |
extern T callee_4b (void); |
| 61 |
|
| 62 |
int test_4 (void) |
| 63 |
{ |
| 64 |
return callee_4a () + callee_4b (); /* { dg-error "invalid operands to binary \+" } */ |
| 65 |
|
| 66 |
/* { dg-begin-multiline-output "" } |
| 67 |
return callee_4a () + callee_4b (); |
| 68 |
~~~~~~~~~~~~ ^ ~~~~~~~~~~~~ |
| 69 |
| | |
| 70 |
| T {aka struct t} |
| 71 |
S {aka struct s} |
| 72 |
{ dg-end-multiline-output "" } */ |
| 73 |
} |
| 74 |
|