This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: can't take address of static template member funcion?
- To: Martin von Loewis <martin at mira dot isdn dot cs dot tu-berlin dot de>
- Subject: Re: can't take address of static template member funcion?
- From: Corey Kosak <kosak at cs dot cmu dot edu>
- Date: Sun, 24 May 1998 18:20:31 -0400
- cc: njs3 at doc dot ic dot ac dot uk, kosak at cs dot cmu dot edu, egcs-bugs at cygnus dot com
> > > void (*fp)()=&cow().template func<int>; // error
> [...]
> > void (*fp)() = &cow::template func<int>;
> >
>
> I think both notations are valid. The first one creates a temporary
> cow, and accesses its (static) (template) member function.
No. A temporary is not created [and g++ correctly does not create one]:
r.9.4, Stroustrup, 2nd ed. A static member mem of class cl can be
referred to as cl::mem (sec r.5.1), that is, independently of any
object. In can also be referred to using the . and -> member access
operators (sec 4.5.2.4). When a static member is accessed through a
member access operator, the expression on the left side of the . or ->
is not evaluated.