2003-12-26 Guilhem Lavaux <guilhem@kaffe.org>
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb22.C
blob3d4cc031e414925e0390373e6492f6cfb13d2da0
1 // { dg-do assemble  }
2 // Ambiguous conversion, three candidates:
3 // builtin == (int, int), and the two user-defined operators
4 // Each one requires a user-defined ICS where another uses builtin conversions,
5 // so none is the best viable function.
7 class MyInt
9 public:
10         MyInt(int = 0) {}
11         operator int() const {return 2;}
14 bool operator==(const MyInt& a, const int& b)
15 {                                               // { dg-error "" } candidate
16         return (int)a == b;
19 bool operator==(const MyInt& a, const MyInt& b)
20 {                                               // { dg-error "" } candidate
21         return (int)a == (int)b;
24 bool f()
26   return 3 == MyInt();                          // { dg-error "" } ambiguous