can't take address of static template member funcion?

Alexandre Oliva oliva@dcc.unicamp.br
Mon May 25 08:48:00 GMT 1998


Martin von Loewis <martin@mira.isdn.cs.tu-berlin.de> writes:

>> >   void (*fp)()=&cow().template func<int>; // error
> [...]
>> void (*fp)() = &cow::template func<int>;
>> 

> Unless there is some restriction on taking member addresses, accessing
> static members through objects is OK, and g++ is in error.

There is such a restriction [expr.unary.op]/3:

3 A pointer to member is only formed when an explicit & is used and  its
  operand  is  a  qualified-id not enclosed in parentheses

`cow().template func<int>' is not a qualified-id.

-- 
Alexandre Oliva
mailto:oliva@dcc.unicamp.br mailto:aoliva@acm.org
http://www.dcc.unicamp.br/~oliva
Universidade Estadual de Campinas, SP, Brasil




More information about the Gcc-bugs mailing list