blob: c17d613cae985424143aef4e0541a1c4b88aa465 [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +00002
3enum E2 { };
4
5struct A {
Douglas Gregor20093b42009-12-09 23:02:17 +00006 operator E2&(); // expected-note 2 {{candidate function}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +00007};
8
9struct B {
Douglas Gregor20093b42009-12-09 23:02:17 +000010 operator E2&(); // expected-note 2 {{candidate function}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000011};
12
13struct C : B, A {
14};
15
16void test(C c) {
Douglas Gregor20093b42009-12-09 23:02:17 +000017 // 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 Jahaniand9290cb2009-10-14 00:52:43 +000019}
20
21void foo(const E2 &);
22
23const 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