| 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" } |
| 11 |
|
| 12 |
/* { dg-begin-multiline-output "" } |
| 13 |
myvec[1] / ptr; |
| 14 |
~~~~~~~~ ^ ~~~ |
| 15 |
| | |
| 16 |
| const int* |
| 17 |
__m128 {aka float} |
| 18 |
{ dg-end-multiline-output "" } */ |
| 19 |
} |
| 20 |
|
| 21 |
struct s {}; |
| 22 |
struct t {}; |
| 23 |
extern struct s some_function (void); |
| 24 |
extern struct t some_other_function (void); |
| 25 |
|
| 26 |
int test_2 (void) |
| 27 |
{ |
| 28 |
return (some_function () |
| 29 |
+ some_other_function ()); // { dg-error "no match for .operator" } |
| 30 |
|
| 31 |
/* { dg-begin-multiline-output "" } |
| 32 |
return (some_function () |
| 33 |
~~~~~~~~~~~~~~~~ |
| 34 |
| |
| 35 |
s |
| 36 |
+ some_other_function ()); |
| 37 |
^ ~~~~~~~~~~~~~~~~~~~~~~ |
| 38 |
| |
| 39 |
t |
| 40 |
{ dg-end-multiline-output "" } */ |
| 41 |
} |
| 42 |
|
| 43 |
int test_3 (struct s param_s, struct t param_t) |
| 44 |
{ |
| 45 |
return param_s && param_t; // { dg-error "no match for .operator" } |
| 46 |
|
| 47 |
/* { dg-begin-multiline-output "" } |
| 48 |
return param_s && param_t; |
| 49 |
~~~~~~~ ^~ ~~~~~~~ |
| 50 |
| | |
| 51 |
s t |
| 52 |
{ dg-end-multiline-output "" } */ |
| 53 |
/* { dg-begin-multiline-output "" } |
| 54 |
return param_s && param_t; |
| 55 |
~~~~~~~~^~~~~~~~~~ |
| 56 |
{ dg-end-multiline-output "" } */ |
| 57 |
} |
| 58 |
|
| 59 |
namespace ns_4 |
| 60 |
{ |
| 61 |
struct s foo; |
| 62 |
namespace inner { |
| 63 |
struct t bar; |
| 64 |
}; |
| 65 |
}; |
| 66 |
|
| 67 |
int test_4a (void) |
| 68 |
{ |
| 69 |
return ns_4::foo && ns_4::inner::bar; // { dg-error "no match for .operator" } |
| 70 |
/* { dg-begin-multiline-output "" } |
| 71 |
return ns_4::foo && ns_4::inner::bar; |
| 72 |
~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~ |
| 73 |
| | |
| 74 |
s t |
| 75 |
{ dg-end-multiline-output "" } */ |
| 76 |
|
| 77 |
/* { dg-begin-multiline-output "" } |
| 78 |
return ns_4::foo && ns_4::inner::bar; |
| 79 |
~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ |
| 80 |
{ dg-end-multiline-output "" } */ |
| 81 |
} |
| 82 |
|
| 83 |
int test_4b (void) |
| 84 |
{ |
| 85 |
return ::ns_4::foo && ns_4::inner::bar; // { dg-error "no match for .operator" } |
| 86 |
/* { dg-begin-multiline-output "" } |
| 87 |
return ::ns_4::foo && ns_4::inner::bar; |
| 88 |
~~~~~~~~~~~ ^~ ~~~~~~~~~~~~~~~~ |
| 89 |
| | |
| 90 |
s t |
| 91 |
{ dg-end-multiline-output "" } */ |
| 92 |
|
| 93 |
/* { dg-begin-multiline-output "" } |
| 94 |
return ::ns_4::foo && ns_4::inner::bar; |
| 95 |
~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~ |
| 96 |
{ dg-end-multiline-output "" } */ |
| 97 |
} |