summaryrefslogtreecommitdiffstats
path: root/clang/test/SemaCXX/ambig-user-defined-conversions.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/test/SemaCXX/ambig-user-defined-conversions.cpp')
-rw-r--r--clang/test/SemaCXX/ambig-user-defined-conversions.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/clang/test/SemaCXX/ambig-user-defined-conversions.cpp b/clang/test/SemaCXX/ambig-user-defined-conversions.cpp
new file mode 100644
index 00000000000..1117253d367
--- /dev/null
+++ b/clang/test/SemaCXX/ambig-user-defined-conversions.cpp
@@ -0,0 +1,26 @@
+// RUN: clang-cc -fsyntax-only -verify %s
+
+struct BASE {
+ operator int &(); // expected-note 4 {{candidate function}}
+};
+struct BASE1 {
+ operator int &(); // expected-note 4 {{candidate function}}
+};
+
+struct B : public BASE, BASE1 {
+
+};
+
+extern B f();
+
+B b1;
+void func(const int ci, const char cc); // expected-note {{function not viable because of ambiguity in conversion of argument 1}}
+void func(const char ci, const B b); // expected-note {{function not viable because of ambiguity in conversion of argument 1}}
+void func(const B b, const int ci); // expected-note {{function not viable because of ambiguity in conversion of argument 2}}
+
+
+const int main() {
+ func(b1, f()); // expected-error {{no matching function for call to 'func'}}
+ return f(); // expected-error {{conversion from 'struct B' to 'int const' is ambiguous}}
+}
+
OpenPOWER on IntegriCloud