This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Broken function reference error?
- From: Alexandre Oliva <aoliva at redhat dot com>
- To: AWLaFramboise at aol dot com
- Cc: gcc at gcc dot gnu dot org
- Date: 26 Jan 2003 05:24:17 -0200
- Subject: Re: Broken function reference error?
- Organization: GCC Team, Red Hat
- References: <450255EF.634EBAAD.E8E247C1@aol.com>
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