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.
5 // Special Options: -Wconversion
6
7 struct A {
8 operator const char *() const { return ""; }
9 };
10
11 struct B : public A {
12 operator char *() { return 0; }
13 };
14
main()15 int main()
16 {
17 B b;
18 if ((const char *)b != 0) // WARNING - surprising overload resolution
19 return 1;
20 if ((const char *)(const B)b == 0)
21 return 2;
22 if ((const char *)(const B &)b == 0)
23 return 3;
24 }
25