This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Question about gcc 3.x
- From: Joe Buck <jbuck at synopsys dot com>
- To: pfrancq at ulb dot ac dot be (Pascal Francq)
- Cc: pfeifer at dbai dot tuwien dot ac dot at (Gerald Pfeifer), gcc at gcc dot gnu dot org
- Date: Fri, 8 Nov 2002 09:26:06 -0800 (PST)
- Subject: Re: Question about gcc 3.x
> Thanks, it works by adding the keyword 'typename'. I did not know about this
> keyword, and I do not understand why this keyword must be added. I will look
> for an updated C++ book in the next weeks.
The reason is to allow C++ templates to be completely parsed at the time
they are declared, instead of waiting for them to be instantiated.
Roughly speaking, a name that is not defined in the template itself, or
provided as a typename/class argument to the template, is assumed to be an
identifier. If it is supposed to be a type, the typename keyword must be
used.