In the code snippet below, the comparison (nullptr == pmf) in main should
compile but on gcc it fails to compile. Compiler fails to find appropriate
conversion operator and gives error saying:
error: no match for operator== in nullptr == pmf
class nullptr_t
{
public:
template<class T>
operator T*() const // convertible to any type of null non-member
pointer...
{ return 0; }
template<class C, class T>
operator T C::*() const // or any type of null member pointer...
{ return 0; }
} nullptr = {};
struct C
{
void func ();
};
int main(void)
{
char * ch = nullptr;
void (C::*pmf)() = nullptr;
if (nullptr == ch) {} // Compiles successfully
if (nullptr == pmf) {} // Should compile but does not compile on gcc
4.1.1
}
--
Summary: bug in lookup of member template conversion operator for
pointer to member functions
Product: gcc
Version: 4.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: sutambe at yahoo dot com
GCC host triplet: Linux i686
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33990