[Clang] Fix constraint checking of non-generic lambdas.
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 Reviewed By: #clang-language-wg, aaron.ballman Differential Revision: https://reviews.llvm.org/D154368
Loading
Please sign in to comment