This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: -pedantic and typedef inheritance.


On Jan  8, 2000, Gerhard Esterhuizen <goof@dsp.sun.ac.za> wrote:

> I have a piece of code that contains a typedef in a templated base class
> that seems to inherit down to the the derived class depending on whether
> or not I use the -pedantic flag. Does this indicate that my code is wrong
> (non ANSI/ISO) or should I not use the pedantic flag ? 

Your code is wrong, but it is accepted without -pedantic as an
extension.  According to the C++ Standard, template-dependent base
classes are not examined during template parsing.  Inherited members,
including typenames, must be qualified and prefixed by the `typename'
keyword:

        typename Base3<Derived3<_TD>>::T_Generic t = 2;

-- 
Alexandre Oliva http://www.ic.unicamp.br/~oliva IC-Unicamp, Bra[sz]il
oliva@{lsd.ic.unicamp.br,guarana.{org,com}} aoliva@{acm,computer}.org
oliva@{gnu.org,kaffe.org,{egcs,sourceware}.cygnus.com,samba.org}
** I may forward mail about projects to mailing lists; please use them


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]