summaryrefslogtreecommitdiff
path: root/gcc/testsuite/g++.dg/overload/ambig1.C
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/g++.dg/overload/ambig1.C')
-rw-r--r--gcc/testsuite/g++.dg/overload/ambig1.C24
1 files changed, 24 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/overload/ambig1.C b/gcc/testsuite/g++.dg/overload/ambig1.C
new file mode 100644
index 000000000..d11e00a18
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/ambig1.C
@@ -0,0 +1,24 @@
+// [over.best.ics]: For the purpose of ranking implicit conversion
+// sequences as described in _over.ics.rank_, the ambiguous conversion
+// sequence is treated as a user-defined sequence that is indistinguishable
+// from any other user- defined conversion sequence.
+
+struct A
+{
+ A(long);
+ A(char);
+};
+
+struct B
+{
+ B(int);
+};
+
+void f(A); // { dg-message "note" "candidate" }
+void f(B); // { dg-message "note" "candidate" }
+
+int main()
+{
+ f (42); // { dg-error "ambiguous" "ambiguous" }
+ // { dg-message "candidate" "candidate note" { target *-*-* } 22 }
+}