gcc 3.0.2 prerelease; Solaris SPARC 2.7.1; Parse error

Phil Edwards pedwards@disaster.jaj.com
Tue Oct 16 13:16:00 GMT 2001


On Tue, Oct 16, 2001 at 12:39:58PM -0700, mckelvey wrote:
> 
> Attached small program gets parse errors on prerelease 3.0.2. It compiles on 
> two other compilers.

This is a C++ FAQ and a bug in your code.  "T::iterator" is a dependant name,
and must be prefixed by the keyword 'typename' in order to tell a compiler
that it is in fact the name of a type (and not a member function, etc).

So:

    typename T::iterator end(arg.end());

With that change, the 3.0.2 20011016 prerelease compiles it just fine.


Phil

-- 
If ye love wealth greater than liberty, the tranquility of servitude greater
than the animating contest for freedom, go home and leave us in peace.  We seek
not your counsel, nor your arms.  Crouch down and lick the hand that feeds you;
and may posterity forget that ye were our countrymen.            - Samuel Adams



More information about the Gcc-bugs mailing list