aboutsummaryrefslogtreecommitdiff
path: root/test/SemaCXX/ref-init-ambiguous.cpp
diff options
context:
space:
mode:
authorRoman Divacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
committerRoman Divacky <rdivacky@FreeBSD.org>2009-10-14 18:03:49 +0000
commit4c8b24812ddcd1dedaca343a6d4e76f91f398981 (patch)
tree137ebebcae16fb0ce7ab4af456992bbd8d22fced /test/SemaCXX/ref-init-ambiguous.cpp
parent5362a71c02e7d448a8ce98cf00c47e353fba5d04 (diff)
Notes
Diffstat (limited to 'test/SemaCXX/ref-init-ambiguous.cpp')
-rw-r--r--test/SemaCXX/ref-init-ambiguous.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/test/SemaCXX/ref-init-ambiguous.cpp b/test/SemaCXX/ref-init-ambiguous.cpp
new file mode 100644
index 000000000000..dda1ead7b622
--- /dev/null
+++ b/test/SemaCXX/ref-init-ambiguous.cpp
@@ -0,0 +1,28 @@
+// RUN: clang-cc -fsyntax-only -verify %s -std=c++0x
+
+enum E2 { };
+
+struct A {
+ operator E2&(); // expected-note 3 {{candidate function}}
+};
+
+struct B {
+ operator E2&(); // expected-note 3 {{candidate function}}
+};
+
+struct C : B, A {
+};
+
+void test(C c) {
+ const E2 &e2 = c; // expected-error {{reference initialization of type 'enum E2 const &' with initializer of type 'struct C' is ambiguous}}
+}
+
+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}}
+}
+
+