On 05/09/2011 06:49 PM, Nathan Froyd wrote:
The patch below is an updated version of:
http://gcc.gnu.org/ml/libstdc++/2011-02/msg00009.html
Sorry I didn't respond to that message.
In general, my preference is to have diagnostics collocated with the
tests that lead to them, and just run through the same code a second
time if we decide that we want to give a diagnostic. For instance,
that's what I did in joust and synthesized_method_walk. Saving
information ahead of time about why we reject a particular candidate
creates overhead that is useless in the vast majority of cases, since
most compiles succeed.
That said, I'm not going to reject this patch over this issue, but
please keep this principle in mind with future diagnostic improvement
patches.
+ case ur_invalid_arg:
+ case ur_invalid_parm:
+ case ur_invalid_init_list:
+ case ur_invalid_template_parm:
+ inform (loc, " an error occurred during template argument deduction");
These are all cases of bailing out when we encounter an error_mark_node
that indicates an earlier error from an ill-formed expression or
whatever. I don't see any reason to have separate cases for them, and
the message is misleading; the error didn't occur during deduction, it
occurred before we got to deduction. We just can't do deduction on
ill-formed inputs.
+ case ur_type_mismatch:
+ case ur_pointer_mismatch:
+ case ur_reference_mismatch:
+ inform (loc, " mismatched types %qT and %qT",
Why make these different? They are all cases of the argument and
parameter types not having the same form.
+ case ur_expanding_pack_to_fixed_arg_list:
This is never generated anywhere. And the message in
coerce_template_parms is a sorry to indicate that this is a bug in G++,
not a problem with the user's code.
unify_failure (struct unification_info *ui, tree parm)
...
return unify_failure (ui);
This doesn't compile. Were you testing a previous version of the patch?
I guess I'll stop reviewing the patch now and wait for an update.
Jason