This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Implicit conversion NULL -> templatized member function pointer
- From: "Kevin Ring" <kevin at ternarysoftware dot com>
- To: <gcc-bugs at gcc dot gnu dot org>
- Date: Sun, 8 Dec 2002 22:53:49 -0500
- Subject: Implicit conversion NULL -> templatized member function pointer
Hi all...
The following code will not compile with GCC 3.2:
class MyClass {};
template <class T>
void Test(T* p, void (T::*)(void))
{
}
int main()
{
MyClass* p;
Test(p, 0);
}
The reported error message is:
no matching function for call to `Test(MyClass*&, int)'
However, if I change Test() to look like this:
template <class T>
void Test(T* p, void (MyClass::*)(void))
{
}
It compiles without error. Note that the only thing I have changed is to replace T with MyClass in the member function pointer parameter declaration. Since T in this case is MyClass, the two versions of Test should essentially be identical.
Is this a known bug in GCC?
Thanks,
Kevin