> This should be merged with pp_cxx_parameter_declaration_clause.
>
>> +reqparms_to_string (tree p)
>
>
> And this should have a more generic name.

I called this parms_to_string for symmetry with args_to_string. It
calls pp_cxx_parameter_declaration_clause.


>> +  if (check_requirements (t, args))
>> +    return;
>> +
>> +  ++processing_template_decl;
>> +  tree subst = instantiate_requirements (t, args);
>> +  --processing_template_decl;
>
>
> Surely you need to instantiate before checking, here and elsewhere.

check_requirements will instantiate before evaluating.

There are two instantiations on purpose. If checking succeeds, then
there are no failures in this branch of constraint, so we don't need
to recursively diagnose failures.

The second generates a possibly invalid tree that is useful for
emitting precise diagnostics, written in terms of the template
arguments. Basically, it means I can generate this message:

  'int::type' is not a valid type name.

for failed nested type requirements.


>> +  inform (loc, "    %qE is not valid syntax", TREE_OPERAND (t, 0));
>
>
> I don't think I would mention "syntax" here, since a syntax error would have
> been diagnosed at parse time rather than constraint checking time.


"is not a valid expression" seems more appropriate.


>> +// In an unevaluated context, the substitution of parm decls are not
>> +// properly chained during substitution. Do that here.
>> +static tree
>> +fix_local_parms (tree sparms)
>
> ....
>
> A lot of the new code in pt.c doesn't seem like it needs to be there; let's
> put as much in constraint.cc as we can.  Let's move some of the bits out of
> semantics.c as well.

I think the [fixup|declare]_local_parms could move to semantics.c.
Would you recommend moving tsubst_* for requirements into
constraints.cc?


Andrew

Reply via email to