blob: 4c7908e1137e4f8962c83264df47b9cf4a3573c3 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
Fariborz Jahanian8577c982009-10-20 20:04:46 +00002
3// 13.3.3.2 Ranking implicit conversion sequences
4// conversion of A::* to B::* is better than conversion of A::* to C::*,
5struct A {
6int Ai;
7};
8
9struct B : public A {};
10struct C : public B {};
11
12const char * f(int C::*){ return ""; }
13int f(int B::*) { return 1; }
14
15struct D : public C {};
16
17const char * g(int B::*){ return ""; }
18int g(int D::*) { return 1; }
19
20void test()
21{
22 int i = f(&A::Ai);
23
24 const char * str = g(&A::Ai);
25}
26
27// conversion of B::* to C::* is better than conversion of A::* to C::*
28typedef void (A::*pmfa)();
29typedef void (B::*pmfb)();
30typedef void (C::*pmfc)();
31
32struct X {
33 operator pmfa();
34 operator pmfb();
35};
36
37
38void g(pmfc);
39
40void test2(X x)
41{
42 g(x);
43}
44