Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 1 | // RUN: clang-cc -fsyntax-only -verify %s -std=c++0x |
| 2 | |
| 3 | enum E2 { }; |
| 4 | |
| 5 | struct A { |
Douglas Gregor | 20093b4 | 2009-12-09 23:02:17 +0000 | [diff] [blame] | 6 | operator E2&(); // expected-note 2 {{candidate function}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 7 | }; |
| 8 | |
| 9 | struct B { |
Douglas Gregor | 20093b4 | 2009-12-09 23:02:17 +0000 | [diff] [blame] | 10 | operator E2&(); // expected-note 2 {{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) { |
Douglas Gregor | 20093b4 | 2009-12-09 23:02:17 +0000 | [diff] [blame] | 17 | // FIXME: state that there was an ambiguity in the conversion! |
| 18 | const E2 &e2 = c; // expected-error {{reference to type 'enum E2 const' could not bind to an lvalue of type 'struct C'}} |
Fariborz Jahanian | d9290cb | 2009-10-14 00:52:43 +0000 | [diff] [blame] | 19 | } |
| 20 | |
| 21 | void foo(const E2 &); |
| 22 | |
| 23 | const E2 & re(C c) { |
| 24 | foo(c); // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}} |
| 25 | |
| 26 | return c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}} |
| 27 | } |
| 28 | |
| 29 | |