diff options
author | Jason Merrill <jason@redhat.com> | 2017-03-23 08:50:55 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2017-03-23 08:50:55 -0400 |
commit | 16e9eaa62786ece30c36748a29a0d9d0ca62f345 (patch) | |
tree | 3f3c6bdd46c684fcd15aa29877545bfbfb4b48f7 /gcc | |
parent | ee3ff3945a03908b32b9d2555fcc3c94ae02d5eb (diff) | |
download | gcc-16e9eaa62786ece30c36748a29a0d9d0ca62f345.zip gcc-16e9eaa62786ece30c36748a29a0d9d0ca62f345.tar.gz gcc-16e9eaa62786ece30c36748a29a0d9d0ca62f345.tar.bz2 |
PR c++/77563 - missing ambiguous conversion error.
* call.c (convert_like_real): Use LOOKUP_IMPLICIT.
From-SVN: r246417
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/cp/call.c | 2 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/overload/ambig3.C | 15 |
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" } +} |