https://gcc.gnu.org/bugzilla/show_bug.cgi?id=111504
--- Comment #2 from Xiang Gao <xgao at nvidia dot com> --- (In reply to Andrew Pinski from comment #1) > Fails for the same reason with clang (both with libstdc++ and libc++) .... > > Are you sure this is valid C++ 20 code? I am not 100% sure, but my understanding is, for the SFINAE in inline constexpr bool operator<(const DT& x, const DT& y) The first condition hasLessThan<typename DT::T1, typename DT::T1>::value is just hasLessThan<int64_t, int64_t>::value, which should be true, and (true || anything) is always true. So the condition in SFINAE should be easily evaluated as true. So the operator< for DynamicType should be defined. And if operator< is defined, then the operator<=> of std::vector<DynamicType> should also be defined. This can be validated by changing the definition of operator< by only keeping the first condition: template < typename DT, typename = std::enable_if_t< (hasLessThan<typename DT::T1, typename DT::T1>::value)>> inline constexpr bool operator<(const DT& x, const DT& y) { // implementation omitted return true; } and then both g++ and clang++ will pass. I do observe the same error on clang, but this https://cpp.sh/ seems to compile without problem on C++20.