Fixes: https://github.com/llvm/llvm-project/issues/45563
template<class T> concept True = true; template <class T> concept C1 = requires (T) { requires True<typename T::value> || True<T>; }; template <class T> constexpr bool foo() requires True<typename T::value> || True<T> { return true; } static_assert(C1<double>); // Previously failed due to SFINAE error static_assert(foo<int>()); // but this works fine.
The issue here is the discrepancy between how a nested requirement is evaluated Vs how a non-nested requirement is evaluated.
This patch makes constraint checking consistent for nested requirement
and trailing requires expressions by using the same evaluator.
I'm a little concerned that we're changing to a situation where the constraint in a nested-requirement can be null like this. The other cases it can be null we consider it a 'substitution failure' (see the 1st constructor).
It seems to me that we perhaps need a different state here for that.