------- Comment #1 from redi at gcc dot gnu dot org 2010-08-23 13:17 ------- The summary seems backwards: the conversion shouldn't generate operator==, instead using operator== should trigger the conversion, but fails to when the conversion operator is a template.
Strangely, adding a non-template conversion operator causes template argument deduction to succeed, even though the non-template operator isn't used e.g. #include <iostream> struct null { null() {} template<class T> operator T*() const { return 0; } template<class C, class T> operator T C::*() const { return 0; } private: operator double*() const; // ??? null(const null&); null& operator=(const null&); void operator&() const; }; static struct null null; int main() { int* ptr = null; std::cout << (ptr == null) << ", " << (ptr != null); return 0; } -- redi at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 GCC build triplet|(many, read below) | GCC host triplet|(many, read below) | GCC target triplet|(many, read below) | Keywords| |rejects-valid Last reconfirmed|0000-00-00 00:00:00 |2010-08-23 13:17:12 date| | Summary|[g++ >= 4.5 ] Implicit |[4.5/4.6 Regression] |conversion to pointer does |Implicit conversion to |no longer automatically |pointer does no longer |generate operator== and |automatically generate |operator!=. |operator== and operator!=. http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45383