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