This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]