Broken function reference error?

Alexandre Oliva aoliva@redhat.com
Sun Jan 26 09:19:00 GMT 2003


On Dec  2, 2002, AWLaFramboise@aol.com wrote:

> template<typename function>
> myclass<function> inst_value(function f) {
>   return myclass<function>(f);
> }

When you try to pass this template function a function name, it decays
to pointer-to-function, so `function' ends up with type pointer to
function.  However, in the following template, there's no such
decaying because of `&', so you end up trying to add a data member of
function type to the other template class, but this is a no-no.

> template<typename function>
> myclass<function> inst_ref(function &f) {
>   return myclass<function>(f);
> }

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva@{redhat.com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist                Professional serial bug killer



More information about the Gcc mailing list