From: Jason Merrill Date: Thu, 23 Mar 2017 12:50:55 +0000 (-0400) Subject: PR c++/77563 - missing ambiguous conversion error. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=16e9eaa62786ece30c36748a29a0d9d0ca62f345;p=gcc.git PR c++/77563 - missing ambiguous conversion error. * call.c (convert_like_real): Use LOOKUP_IMPLICIT. From-SVN: r246417 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 98560b053f1..22b7dfae028 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2017-03-23 Jason Merrill + + PR c++/77563 - missing ambiguous conversion error. + * call.c (convert_like_real): Use LOOKUP_IMPLICIT. + 2017-03-23 Marek Polacek * cp-tree.h: Remove a C_RID_YYCODE reference. diff --git a/gcc/cp/call.c b/gcc/cp/call.c index 86c7647e7cd..803fbd4197e 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 00000000000..01d4cc63286 --- /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" } +}