The standard requires member function constraints to be checked when explicitly instantiating classes. This patch adds this constraints check.
This issue is tracked as #46029.
Note that there's an related open CWG issue (2421) about what to do when multiple candidates have satisfied constraints. This is particularly an issue because mangling doesn't contain function constraints, and so the following code still ICEs with definition with same mangled name '_ZN1BIiE1fEv' as another definition:
template<class T> struct B { int f() requires std::same_as<T, int> { return 0; } int f() requires (std::same_as<T, int> && !std::same_as<T, char>) { return 1; } }; template struct B<int>;
Also note that the constraints checking while instantiating *functions* is still not implemented. I started looking at it but It's a bit more complicated. I believe in such a case we have to consider the partial constraints order and potentially choose the best candidate out of the set of multiple valid ones.
I think it might be better to test this via an -ast-dump test (which lives in the AST test directory) rather than emitting LLVM IR to determine whether something was instantiated or not.
Btw, when you convert the test to use -ast-dump, be sure to make use of regexes for things like line, column numbers, pointer values, etc so that the test is easier to edit without breaking.