Daniel Dunbar | a572887 | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 2 | |
| 3 | enum E2 { }; |
| 4 | |
| 5 | struct A { |
Douglas Gregor | 18ef5e2 | 2009-12-18 05:02:21 +0000 | [diff] [blame] | 6 | operator E2&(); // expected-note 3 {{candidate function}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 7 | }; |
| 8 | |
| 9 | struct B { |
Douglas Gregor | 18ef5e2 | 2009-12-18 05:02:21 +0000 | [diff] [blame] | 10 | operator E2&(); // expected-note 3 {{candidate function}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 11 | }; |
| 12 | |
| 13 | struct C : B, A { |
| 14 | }; |
| 15 | |
| 16 | void test(C c) { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 17 | const E2 &e2 = c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 18 | } |
| 19 | |
| 20 | void foo(const E2 &); |
| 21 | |
| 22 | const E2 & re(C c) { |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 23 | foo(c); // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 24 | |
John McCall | 7c2342d | 2010-03-10 11:27:22 +0000 | [diff] [blame] | 25 | return c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | |