summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/overload/operator6.C
blob: 5002602b698bef340e1eb075fe0403373ea4b7b3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// PR c++/17805

// Per 13.3.1.2/3 bullet 2, an operator function is not a candidate
// for overload resolution if neither argument is of class type and
// neither enumerator-typed argument gets an exact match, with or
// without reference binding, for the corresponding parameter.

struct A
{
  A(int);
  A(const char*);
};

bool operator==(const A&, const A&);
const A& operator*(const A&);

enum E { e };

bool b1 = (e == "");     // { dg-error "no match" }

bool b2 = (A(1) == "");

bool b3 = (e == A(1));

const A& a1 = *e;        // { dg-error "no match" }

const A& a2 = *A(1);