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 | 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) { |
Chris Lattner | 0c42bb6 | 2010-09-05 00:17:29 +0000 | [diff] [blame] | 17 | const E2 &e2 = c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 18 | } |
| 19 | |
Douglas Gregor | a41a8c5 | 2010-04-22 00:20:18 +0000 | [diff] [blame] | 20 | void foo(const E2 &);// expected-note{{passing argument to parameter here}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 21 | |
| 22 | const E2 & re(C c) { |
Chris Lattner | 0c42bb6 | 2010-09-05 00:17:29 +0000 | [diff] [blame] | 23 | foo(c); // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 24 | |
Chris Lattner | 0c42bb6 | 2010-09-05 00:17:29 +0000 | [diff] [blame] | 25 | return c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 26 | } |
| 27 | |
| 28 | |