blob: 8844162052d9a6c769cab773ddb61cb6d722b9a2 [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
Fariborz Jahanian31481d82009-10-14 00:52:43 +00002
3enum E2 { };
4
5struct A {
Douglas Gregore1314a62009-12-18 05:02:21 +00006 operator E2&(); // expected-note 3 {{candidate function}}
Fariborz Jahanian31481d82009-10-14 00:52:43 +00007};
8
9struct B {
Douglas Gregore1314a62009-12-18 05:02:21 +000010 operator E2&(); // expected-note 3 {{candidate function}}
Fariborz Jahanian31481d82009-10-14 00:52:43 +000011};
12
13struct C : B, A {
14};
15
16void test(C c) {
John McCall85f90552010-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 Jahanian31481d82009-10-14 00:52:43 +000018}
19
20void foo(const E2 &);
21
22const E2 & re(C c) {
John McCall85f90552010-03-10 11:27:22 +000023 foo(c); // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
Fariborz Jahanian31481d82009-10-14 00:52:43 +000024
John McCall85f90552010-03-10 11:27:22 +000025 return c; // expected-error {{reference initialization of type 'E2 const &' with initializer of type 'C' is ambiguous}}
Fariborz Jahanian31481d82009-10-14 00:52:43 +000026}
27
28