A lambda call operator can be a templated entity -
and therefore have constraints while not being a function template
template<class T> void f() { []() requires false { }(); }
In that case, we would check the constraints of the call operator
which is non-viable. However, we would find a viable candidate:
the conversion operator to function pointer, and use it to
perform a surrogate call.
These constraints were not checked because:
- We never check the constraints of surrogate functions
- The lambda conversion operator has non constraints.
From the wording, it is not clear what the intent is but
it seems reasonable to expect the constraints of the lambda conversion
operator to be checked and it is consistent with GCC and MSVC.
This patch also improve the diagnostics for constraint failure
on surrogate calls.
Fixes #63181
I think "candidate surrogate function" is a bit... technical for a user-facing diagnostic (we don't seem to use it any other diagnostics). Perhaps we should go with conversion candidate function instead as we did for note_ovl_surrogate_cand?