blob: 27ca6dc77897df7eb1cba96bfe9ebeae554a753f [file] [log] [blame]
Fariborz Jahanian0351a1e2009-10-07 20:43:36 +00001// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
2
3struct A {};
4struct E {};
5
6struct R {
7 operator A*();
Fariborz Jahanian27687cf2009-10-12 17:51:19 +00008 operator E*(); // expected-note{{candidate function}}
Fariborz Jahanian0351a1e2009-10-07 20:43:36 +00009};
10
11
12struct S {
13 operator A*();
Fariborz Jahanian27687cf2009-10-12 17:51:19 +000014 operator E*(); // expected-note{{candidate function}}
Fariborz Jahanian0351a1e2009-10-07 20:43:36 +000015};
16
17struct B : R {
18 operator A*();
19};
20
21struct C : B {
22
23};
24
25void foo(C c, int A::* pmf) {
26 int i = c->*pmf;
27}
28
29struct B1 : R, S {
30 operator A*();
31};
32
33struct C1 : B1 {
34
35};
36
37void foo1(C1 c1, int A::* pmf) {
38 int i = c1->*pmf;
Fariborz Jahanian27d4be52009-10-08 18:00:39 +000039 c1->*pmf = 10;
Fariborz Jahanian0351a1e2009-10-07 20:43:36 +000040}
41
42void foo1(C1 c1, int E::* pmf) {
43 // FIXME. Error reporting needs much improvement here.
Fariborz Jahanian27687cf2009-10-12 17:51:19 +000044 int i = c1->*pmf; // expected-error {{left hand operand to ->* must be a pointer to class compatible with the right hand operand, but is 'struct C1'}} \
45 // expected-note {{because of ambiguity in conversion of 'struct C1' to 'struct E *'}}
Fariborz Jahanian0351a1e2009-10-07 20:43:36 +000046}