FSF GCC merge 02/23/03
[official-gcc.git] / gcc / testsuite / g++.old-deja / g++.other / overcnv2.C
blobf8ef3d39e9b8c0ad24fdc2b57c2f31e9ecda8483
1 // Test that we resolve this case as mandated by the standard, but also
2 // warn about it.  We choose op char* not because it is a member of B --
3 // the standard says that all conversion ops are treated as coming from
4 // the type of the argument -- but because it is non-const.
6 struct A  {
7   operator const char *() const { return ""; }
8 };
10 struct B : public A {
11   operator char *() { return 0; }
14 int main()
16   B b;
17   if ((const char *)b != 0)  // WARNING - surprising overload resolution
18     return 1;
19   if ((const char *)(const B)b == 0)
20     return 2;
21   if ((const char *)(const B &)b == 0)
22     return 3;