This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/33990] bug in lookup of member template conversion operator for pointer to member functions
- From: "ylalym at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Oct 2009 15:33:31 -0000
- Subject: [Bug c++/33990] bug in lookup of member template conversion operator for pointer to member functions
- References: <bug-33990-15278@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #3 from ylalym at gmail dot com 2009-10-04 15:33 -------
(In reply to comment #0)
There is a makeshift.
File a.cpp
#include <stdio.h>
const class nullptr_t
{
public:
template<class T> operator T*() const { return 0; }
template<class C, class T> operator T C::*() const { return 0; }
// void (C::*pmf)() = nullptr; // Ok
// if (nullptr == pmf) {} // Ok
template<class C, class T> bool operator == (C (T::*p)()) const
{ return p == 0; }
private:
void operator&() const;
// const int n = 0;
// if (nullptr == n) {} // Error
bool operator == (long) const;
}
nullptr = {};
struct C
{
void func();
};
int main(void)
{
void (C::*pmf)() = nullptr;
if (nullptr == pmf) {printf("Ok\n");}
// If there are sentences - send !!!!!!!!
// if (pmf == nullptr) {printf("Ok\n");} // Error
}
> g++ a.cpp
> ./a.out
Ok
>
--
ylalym at gmail dot com changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ylalym at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=33990