aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/call.c2
-rw-r--r--gcc/testsuite/g++.dg/overload/ambig3.C15
3 files changed, 21 insertions, 1 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 98560b0..22b7dfa 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2017-03-23 Jason Merrill <jason@redhat.com>
+
+ PR c++/77563 - missing ambiguous conversion error.
+ * call.c (convert_like_real): Use LOOKUP_IMPLICIT.
+
2017-03-23 Marek Polacek <polacek@redhat.com>
* cp-tree.h: Remove a C_RID_YYCODE reference.
diff --git a/gcc/cp/call.c b/gcc/cp/call.c
index 86c7647..803fbd4 100644
--- a/gcc/cp/call.c
+++ b/gcc/cp/call.c
@@ -6764,7 +6764,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (complain & tf_error)
{
/* Call build_user_type_conversion again for the error. */
- build_user_type_conversion (totype, convs->u.expr, LOOKUP_NORMAL,
+ build_user_type_conversion (totype, convs->u.expr, LOOKUP_IMPLICIT,
complain);
if (fn)
inform (DECL_SOURCE_LOCATION (fn),
diff --git a/gcc/testsuite/g++.dg/overload/ambig3.C b/gcc/testsuite/g++.dg/overload/ambig3.C
new file mode 100644
index 0000000..01d4cc6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/overload/ambig3.C
@@ -0,0 +1,15 @@
+// PR c++/77563
+
+struct A {
+ A(int) {}
+ A(unsigned) {} // Comment to make it work
+
+ explicit A(long) {} // Comment to make it work
+};
+
+void f(A) { }
+
+int main() {
+ f(2);
+ f(3l); // { dg-error "ambiguous" }
+}