Richard Smith | 762bb9d | 2011-10-13 22:29:44 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11 |
Fariborz Jahanian | 0351a1e | 2009-10-07 20:43:36 +0000 | [diff] [blame] | 2 | |
| 3 | struct A {}; |
| 4 | struct E {}; |
| 5 | |
| 6 | struct R { |
| 7 | operator A*(); |
Fariborz Jahanian | 27687cf | 2009-10-12 17:51:19 +0000 | [diff] [blame] | 8 | operator E*(); // expected-note{{candidate function}} |
Fariborz Jahanian | 0351a1e | 2009-10-07 20:43:36 +0000 | [diff] [blame] | 9 | }; |
| 10 | |
| 11 | |
| 12 | struct S { |
| 13 | operator A*(); |
Fariborz Jahanian | 27687cf | 2009-10-12 17:51:19 +0000 | [diff] [blame] | 14 | operator E*(); // expected-note{{candidate function}} |
Fariborz Jahanian | 0351a1e | 2009-10-07 20:43:36 +0000 | [diff] [blame] | 15 | }; |
| 16 | |
| 17 | struct B : R { |
| 18 | operator A*(); |
| 19 | }; |
| 20 | |
| 21 | struct C : B { |
| 22 | |
| 23 | }; |
| 24 | |
| 25 | void foo(C c, int A::* pmf) { |
| 26 | int i = c->*pmf; |
| 27 | } |
| 28 | |
| 29 | struct B1 : R, S { |
| 30 | operator A*(); |
| 31 | }; |
| 32 | |
| 33 | struct C1 : B1 { |
| 34 | |
| 35 | }; |
| 36 | |
| 37 | void foo1(C1 c1, int A::* pmf) { |
| 38 | int i = c1->*pmf; |
Fariborz Jahanian | 27d4be5 | 2009-10-08 18:00:39 +0000 | [diff] [blame] | 39 | c1->*pmf = 10; |
Fariborz Jahanian | 0351a1e | 2009-10-07 20:43:36 +0000 | [diff] [blame] | 40 | } |
| 41 | |
| 42 | void foo1(C1 c1, int E::* pmf) { |
John McCall | 1d31833 | 2010-01-12 00:44:57 +0000 | [diff] [blame] | 43 | int i = c1->*pmf; // expected-error {{use of overloaded operator '->*' is ambiguous}} \ |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 44 | // expected-note {{because of ambiguity in conversion of 'C1' to 'E *'}} \ |
John McCall | 1d31833 | 2010-01-12 00:44:57 +0000 | [diff] [blame] | 45 | // expected-note 4 {{built-in candidate operator}} |
Fariborz Jahanian | 0351a1e | 2009-10-07 20:43:36 +0000 | [diff] [blame] | 46 | } |