https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101485
--- Comment #5 from Jan Schultke <janschultke at googlemail dot com> --- &operator==(E,E); is not a valid expression, but I understand what you're trying to do there. Perhaps you can test by converting to a function pointer bool(*)(E,E). It would surely miss cases like an operator== with an always-defaulted third parameter, or one where the return type is contextually convertible to bool, but not exactly bool, or: template <std::same_as<E> T> bool operator==(T, T) { return false; } ... or other cases. You would really need some way to detect whether an expression (x == y) uses any overloaded operators, and I don't see how you could do that (without additional intrinsics).