blob: ce47e10c9ae3e4bdec9c38254ae76d9acb0e62e2 [file] [log] [blame]
Richard Smith762bb9d2011-10-13 22:29:44 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++11
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) {
Chris Lattner0c42bb62010-09-05 00:17:29 +000017 const E2 &e2 = c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000018}
19
Douglas Gregora41a8c52010-04-22 00:20:18 +000020void foo(const E2 &);// expected-note{{passing argument to parameter here}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000021
22const E2 & re(C c) {
Chris Lattner0c42bb62010-09-05 00:17:29 +000023 foo(c); // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000024
Chris Lattner0c42bb62010-09-05 00:17:29 +000025 return c; // expected-error {{reference initialization of type 'const E2 &' with initializer of type 'C' is ambiguous}}
Fariborz Jahaniand9290cb2009-10-14 00:52:43 +000026}
27
28