blob: 8844162052d9a6c769cab773ddb61cb6d722b9a2 [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 Gregor18ef5e22009-12-18 05:02:21 +00006 operator E2&(); // expected-note 3 {{candidate function}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +00007};
8
9struct B {
Douglas Gregor18ef5e22009-12-18 05:02:21 +000010 operator E2&(); // expected-note 3 {{candidate function}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000011};
12
13struct C : B, A {
14};
15
16void test(C c) {
John McCall7c2342d2010-03-10 11:27:22 +000017 const E2 &e2 = c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000018}
19
20void foo(const E2 &);
21
22const E2 & re(C c) {
John McCall7c2342d2010-03-10 11:27:22 +000023 foo(c); // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000024
John McCall7c2342d2010-03-10 11:27:22 +000025 return c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000026}
27
28