opnsense-src/test/SemaCXX/ref-init-ambiguous.cpp

29 lines
726 B
C++
Raw Normal View History

2010-01-01 05:34:51 -05:00
// RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++0x
2009-10-14 14:03:49 -04:00
enum E2 { };
struct A {
2010-01-01 05:34:51 -05:00
operator E2&(); // expected-note 3 {{candidate function}}
2009-10-14 14:03:49 -04:00
};
struct B {
2010-01-01 05:34:51 -05:00
operator E2&(); // expected-note 3 {{candidate function}}
2009-10-14 14:03:49 -04:00
};
struct C : B, A {
};
void test(C c) {
2010-01-01 05:34:51 -05:00
const E2 &e2 = c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}}
2009-10-14 14:03:49 -04:00
}
void foo(const E2 &);
const E2 & re(C c) {
foo(c); // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}}
return c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}}
}