FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.robertl / eb22.C
blobf604a5a3573d6c373600a64ce381fa652cfa436f
1 // Ambiguous conversion, three candidates:
2 // builtin == (int, int), and the two user-defined operators
3 // Each one requires a user-defined ICS where another uses builtin conversions,
4 // so none is the best viable function.
6 class MyInt
8 public:
9         MyInt(int = 0) {}
10         operator int() const {return 2;}
13 bool operator==(const MyInt& a, const int& b)
14 {                                               // ERROR - candidate
15         return (int)a == b;
18 bool operator==(const MyInt& a, const MyInt& b)
19 {                                               // ERROR - candidate
20         return (int)a == (int)b;
23 bool f()
25   return 3 == MyInt();                          // ERROR - ambiguous