I believe the following code is valid and should be accepted. // g++ -std=c++11 struct Foo { template <class T> operator T() const; }; // error: no match for 'operator==' (operand types are 'Foo' and 'void*') bool R = (Foo{} == static_cast<void*>(nullptr)); Note that when Foo's conversion operator is declared as `operator T*()`, the code is accepted. See https://godbolt.org/z/nc43wx
Confirmed here is a C++98 version which shows this has always been an issue: struct Foo { template <class T> operator T() const; }; Foo *a; Foo t; bool R = (t == a);