[clang] use canonical arguments for checking function template constraints (#186889)
This is a partial revert of #161671, restoring the original behaviour
where the canonical template arguments are used for function template
constraint checking in diagnostics.
This reverts the fix from #183010, which attempted to fix #182344
but it causes regressions. These regressions now have test cases
included.
The attempt at #183010 is flawed because in the general case we can't
check satisfaction for constraints which have unsubstituted template
arguments, even if they don't affect the canonical type (ie they are
purely
syntactical), because these types can still turn out to be invalid after
substitution.
This is a problem when directly evaluating a concept specialization, but
it's not a problem with other template specializations because the
as-written types are preserved, and will be later substituted, and any
failures
here will cause the program to be ill-formed anyway.
The only downside of this revert is the loss of sugar in some
diagnostics.
This could be improved in the future by adding a new flag which would
allow ignoring this instantiation dependence in such cases where a
substitution failure will be handled later anyway.
This is not done in this patch because we want the safest thing
possible, to help backporting this patch to Clang 22.
This preserves the tests from #183010 and also adds the tests from
#185608.
Since this fixes a regression since Clang 21 and will be backported to
Clang 22, there are no release notes.