Daniel Dunbar | 8fbe78f | 2009-12-15 20:14:24 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x |
Fariborz Jahanian | 31481d8 | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 2 | |
| 3 | enum E2 { }; |
| 4 | |
| 5 | struct A { |
Douglas Gregor | e1314a6 | 2009-12-18 05:02:21 +0000 | [diff] [blame] | 6 | operator E2&(); // expected-note 3 {{candidate function}} |
Fariborz Jahanian | 31481d8 | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 7 | }; |
| 8 | |
| 9 | struct B { |
Douglas Gregor | e1314a6 | 2009-12-18 05:02:21 +0000 | [diff] [blame] | 10 | operator E2&(); // expected-note 3 {{candidate function}} |
Fariborz Jahanian | 31481d8 | 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 | 85f9055 | 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 | 31481d8 | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Douglas Gregor | 4f4946a | 2010-04-22 00:20:18 +0000 | [diff] [blame^] | 20 | void foo(const E2 &);// expected-note{{passing argument to parameter here}} |
Fariborz Jahanian | 31481d8 | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 21 | |
| 22 | const E2 & re(C c) { |
John McCall | 85f9055 | 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 | 31481d8 | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 24 | |
John McCall | 85f9055 | 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 | 31481d8 | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | |