public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Template argument (pointer to member function) initialization with NULL
@ 2011-11-14 21:48 vagran.ast
  2011-11-14 21:51 ` Jonathan Wakely
  0 siblings, 1 reply; 5+ messages in thread
From: vagran.ast @ 2011-11-14 21:48 UTC (permalink / raw)
  To: gcc-help

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

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-11-16 18:29 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-14 21:48 Template argument (pointer to member function) initialization with NULL vagran.ast
2011-11-14 21:51 ` Jonathan Wakely
2011-11-15 13:15   ` vagran.ast
2011-11-15 19:55     ` Jonathan Wakely
2011-11-16 21:11       ` vagran.ast

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).