Commit 16e9eaa6 by Jason Merrill Committed by Jason Merrill

PR c++/77563 - missing ambiguous conversion error.

	* call.c (convert_like_real): Use LOOKUP_IMPLICIT.

From-SVN: r246417
parent ee3ff394
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> 2017-03-23 Marek Polacek <polacek@redhat.com>
* cp-tree.h: Remove a C_RID_YYCODE reference. * cp-tree.h: Remove a C_RID_YYCODE reference.
......
...@@ -6764,7 +6764,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum, ...@@ -6764,7 +6764,7 @@ convert_like_real (conversion *convs, tree expr, tree fn, int argnum,
if (complain & tf_error) if (complain & tf_error)
{ {
/* Call build_user_type_conversion again for the 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); complain);
if (fn) if (fn)
inform (DECL_SOURCE_LOCATION (fn), inform (DECL_SOURCE_LOCATION (fn),
......
// 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" }
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment