Constraint expressions will now not be substituted into when instantiating constrained declarations, and all substitution will be delayed to when satisfaction or subsumption have to be determined. Also, when explicitly instantiating a class template specialization, members whose constraints are not satisfied will not be instantiated. Depends on D50360.
I wonder if there's a cleaner way to model this:
Suppose we add a new Expr subclass for an expression with delayed template argument substitution, which would capture a list of TemplateArguments and an inner Expr* into which those template arguments have not yet been substituted. Then when we transform a trailing requires-clause, we can wrap it suitably with that expression node, and similarly when we transform a TypeConstraint we can wrap the immediately-declared constraint in the partial substitution wrapper.
We'd need to teach normalization to pick up the wrapper and turn it into a parameter mapping, and we'd need to teach satisfaction checking to actually substitute that partially-substituted wrapper, but I think the result would be a bit simpler and wouldn't need us to carefully keep track of whether each individual constraint is substituted or not. What do you think?
Please can you introduce a typedef or wrapper type for this? Maybe a struct TemplateHeadConstraints or similar?
Consider passing the union type (whatever it's called) here instead of having an Expr* argument and a TemplateParameterList* argument, at least one of which must be null.
Is it feasible to tail-allocate the pointer? (At least in the case where there is no type-constraint, it'd be nice to avoid allocating storage for it; allocating it unconditionally along with the TypeConstraint seems good enough to me.)