Template argument (pointer to member function) initialization with NULL

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

In the following code:

class A {
public:
    void SomeMethod() { }
};

template <class T, void (T::*SomeMethod)() = 0>
class B {

};

B<A> b1; // error: could not convert template argument '0' to 'void (A::*)()'

B<A, 0> b2; // error: could not convert template argument '0' to 'void (A::*)()'

void (A::*someMethod)() = 0; // OK

there are two compilation errors. AFAIK per C++ standard 0 is a valid value for a pointer to member function. Variable of such type can be successfully initialized by 0 but template arguments can not.
Is it desired behavior or a bug?

gcc version 4.6.1



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux