* call.c (convert_like_real): Use LOOKUP_IMPLICIT.
From-SVN: r246417
+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.
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),
--- /dev/null
+// 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" }
+}