Debian Codegraph @

gcc/testsuite/g++.dg/diagnostic/bad-binary-ops2.C

raw
1 // PR c++/107382
2 // PR c++/107383
3 // { dg-do compile }
4 // { dg-options "-O2 -fexcess-precision=standard" }
5
6 void
7 foo ()
8 {
9 float t[2] = { 1, 2 };
10 int const *s = 0;
11 t[1] / s; // { dg-error "invalid operands of types 'float' and 'const int\\\*' to binary 'operator/'" }
12 }
13
14 void
15 bar ()
16 {
17 float t[2] = { 1, 2 };
18 int const *s[2] = { 0, 0 };
19 t[1] / s[0]; // { dg-error "invalid operands of types 'float' and 'const int\\\*' to binary 'operator/'" }
20 }
21
22 void
23 baz (float a, int* b)
24 {
25 a -= b; // { dg-error "invalid operands of types 'float' and 'int\\\*' to binary 'operator-'" }
26 }