2015-10-31 Jason Merrill <jason@redhat.com>
+ * pt.c (unify): Don't diagnose no common base if we already have
+ the same template.
+ (do_auto_deduction): Explain deduction failure.
+
* pt.c (hash_tmpl_and_args): Use iterative_hash_object on template
uid.
explain_p, &t);
if (!t)
- return unify_no_common_base (explain_p, r, parm, arg);
+ {
+ /* Don't give the derived diagnostic if we're
+ already dealing with the same template. */
+ bool same_template
+ = (CLASSTYPE_TEMPLATE_INFO (arg)
+ && (CLASSTYPE_TI_TEMPLATE (parm)
+ == CLASSTYPE_TI_TEMPLATE (arg)));
+ return unify_no_common_base (explain_p && !same_template,
+ r, parm, arg);
+ }
}
}
else if (CLASSTYPE_TEMPLATE_INFO (arg)
error ("unable to deduce lambda return type from %qE", init);
else
error ("unable to deduce %qT from %qE", type, init);
+ type_unification_real (tparms, targs, parms, &init, 1, 0,
+ DEDUCE_CALL, LOOKUP_NORMAL,
+ NULL, /*explain_p=*/true);
}
return error_mark_node;
}
f<0>(s0, s2);
f(s0, s2); // { dg-error "" } no matching function
- // { dg-message "(candidate|deduced conflicting types|ambiguous base class)" "candidate note" { target *-*-* } 17 }
+ // { dg-message "(candidate|deduced conflicting|ambiguous base class)" "candidate note" { target *-*-* } 17 }
}