Debian Codegraph @

gcc/testsuite/g++.dg/overload/operator6.C

raw
1 // PR c++/17805
2
3 // Per 13.3.1.2/3 bullet 2, an operator function is not a candidate
4 // for overload resolution if neither argument is of class type and
5 // neither enumerator-typed argument gets an exact match, with or
6 // without reference binding, for the corresponding parameter.
7
8 struct A
9 {
10 A(int);
11 A(const char*);
12 };
13
14 bool operator==(const A&, const A&);
15 const A& operator*(const A&);
16
17 enum E { e };
18
19 bool b1 = (e == ""); // { dg-error "no match" }
20
21 bool b2 = (A(1) == "");
22
23 bool b3 = (e == A(1));
24
25 const A& a1 = *e; // { dg-error "no match" }
26
27 const A& a2 = *A(1);