Debian Codegraph @

gcc/testsuite/g++.dg/lookup/operator-3.C

raw
1 // PR c++/51577
2 // Verify we don't consider later-declared namespace-scope operator overloads
3 // when instantiating a dependent operator expression that occurs at block scope.
4
5 template <class T> void f (T x) {
6 +x; // { dg-error "no match" }
7 -x; // { dg-error "no match" }
8 *x; // { dg-error "no match" }
9 ~x; // { dg-error "no match" }
10 &x;
11 !x; // { dg-error "no match" }
12 ++x; // { dg-error "no match" }
13 --x; // { dg-error "no match" }
14 x++; // { dg-error "declared for postfix" }
15 x--; // { dg-error "declared for postfix" }
16
17 x->*x; // { dg-error "no match" }
18 x / x; // { dg-error "no match" }
19 x * x; // { dg-error "no match" }
20 x + x; // { dg-error "no match" }
21 x - x; // { dg-error "no match" }
22 x % x; // { dg-error "no match" }
23 x & x; // { dg-error "no match" }
24 x | x; // { dg-error "no match" }
25 x ^ x; // { dg-error "no match" }
26 x << x; // { dg-error "no match" }
27 x >> x; // { dg-error "no match" }
28 x && x; // { dg-error "no match" }
29 x || x; // { dg-error "no match" }
30 x, x;
31
32 x == x; // { dg-error "no match" }
33 x != x; // { dg-error "no match" }
34 x < x; // { dg-error "no match" }
35 x > x; // { dg-error "no match" }
36 x <= x; // { dg-error "no match" }
37 x >= x; // { dg-error "no match" }
38 #if __cplusplus > 201703L
39 x <=> x; // { dg-error "no match" "" { target c++20 } }
40 #endif
41
42 x += x; // { dg-error "no match" }
43 x -= x; // { dg-error "no match" }
44 x *= x; // { dg-error "no match" }
45 x /= x; // { dg-error "no match" }
46 x %= x; // { dg-error "no match" }
47 x |= x; // { dg-error "no match" }
48 x ^= x; // { dg-error "no match" }
49 x <<= x; // { dg-error "no match" }
50 x >>= x; // { dg-error "no match" }
51 }
52
53 namespace N { struct A { }; }
54
55 #include "operator-3-ops.h"
56
57 int main() {
58 f(N::A());
59 }