Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/gcc.dg/bad-binary-ops.c @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 84e7813d76e9 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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 { dg-end-multiline-output "" } */ | |
17 | |
18 | |
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 "invalid operands to binary \+" } */ | |
30 | |
31 /* { dg-begin-multiline-output "" } | |
32 return (some_function () | |
33 ~~~~~~~~~~~~~~~~ | |
34 + some_other_function ()); | |
35 ^ ~~~~~~~~~~~~~~~~~~~~~~ | |
36 { dg-end-multiline-output "" } */ | |
37 } | |
38 | |
39 int test_3 (struct s param_s, struct t param_t) | |
40 { | |
41 return param_s + param_t; // { dg-error "invalid operands to binary \+" } | |
42 | |
43 /* { dg-begin-multiline-output "" } | |
44 return param_s + param_t; | |
45 ^ | |
46 { dg-end-multiline-output "" } */ | |
47 /* TODO: ideally we'd underline both params here. */ | |
48 } |