g++ 2.95.2 bug
Patrick J. Moran
pmoran@nas.nasa.gov
Wed Feb 2 14:44:00 GMT 2000
Hello,
>From oliva@lsd.ic.unicamp.br Wed Feb 2 14:11:42 2000
>To: "Patrick J. Moran" <pmoran>
>Cc: gcc-bugs@gcc.gnu.org, bgreen, chenze, pmoran
>Subject: Re: g++ 2.95.2 bug
>References: < 200002022205.OAA16670@potato.nas.nasa.gov >
>From: Alexandre Oliva <oliva@lsd.ic.unicamp.br>
>Date: 02 Feb 2000 20:11:18 -0200
>
>On Feb 2, 2000, "Patrick J. Moran" <pmoran@nas.nasa.gov> wrote:
>> template <class T>
>> void fun()
>> {
>> V<int>::type i; // OK
>> V<T>::type j; // "parse error before `;'"
>
>It's correct. V<T> is template dependent, so, if V<T>::type is
>supposed to be parsed as a type, it *must* be preceded by the
>`typename' keyword. That's a requirement imposed by the C++
>Standard.
>
>g++ sometimes relaxes this requirement as an extension, but it's not
>possible to do at template-parse time (and that's why the rule comes
>in handy). If you compile with -pedantic, gcc should systematically
>reject such constructs.
Indeed. Thanks for your prompt response. I should read the
standard more closely.
Pat
# -----------------------------------------------------------
# Patrick J. Moran http://www.nas.nasa.gov/~pmoran
# MRJ Technology Solutions NASA Ames Research Center
More information about the Gcc-bugs
mailing list