Eric Christopher | 4cbac2a | 2011-08-16 21:41:54 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -emit-llvm -O0 -g %s -o /dev/null |
| 2 | // PR 7104 |
| 3 | |
| 4 | struct A { |
| 5 | int Ai; |
| 6 | }; |
| 7 | |
| 8 | struct B : public A {}; |
| 9 | struct C : public B {}; |
| 10 | |
| 11 | const char * f(int C::*){ return ""; } |
| 12 | int f(int B::*) { return 1; } |
| 13 | |
| 14 | struct D : public C {}; |
| 15 | |
| 16 | const char * g(int B::*){ return ""; } |
| 17 | int g(int D::*) { return 1; } |
| 18 | |
| 19 | void test() |
| 20 | { |
| 21 | int i = f(&A::Ai); |
| 22 | |
| 23 | const char * str = g(&A::Ai); |
| 24 | } |
| 25 | |
| 26 | // conversion of B::* to C::* is better than conversion of A::* to C::* |
| 27 | typedef void (A::*pmfa)(); |
| 28 | typedef void (B::*pmfb)(); |
| 29 | typedef void (C::*pmfc)(); |
| 30 | |
| 31 | struct X { |
| 32 | operator pmfa(); |
| 33 | operator pmfb(); |
| 34 | }; |
| 35 | |
| 36 | |
| 37 | void g(pmfc); |
| 38 | |
| 39 | void test2(X x) |
| 40 | { |
| 41 | g(x); |
| 42 | } |