This is the mail archive of the gcc-help@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]
Other format: [Raw text]

RE: Deriving from templated classes


Hi Lothar,

>This seems strange to me, because i think "bar" and "foo" should be within the namespace of "class Bar".

Yep, I'd think so too.  But that's not what the C++ standard says.  :-(

> The code compiles if i substitute "bar++" with "Foo<A>::bar++" and "foo = 1" with "Foo<A>::foo = 1".

That's what the standards says you need to do.

There may be a few other alternatives, such as this->bar++ or "using" directive.  I use the mechanism you used, so if the alternatives work I haven't actually tried them yet.

> I tried to compile the code snipplet above using compilers from diffrent vendors (intel and m$). Both compiled the code without any errors or warnings.

Then those compilers are non-compliant on this issue.

>My question is: Does gcc do the right thing (tm) or should that behavior reported as a bug?

On this matter, GCC is doing the right thing as per the C++ standard (ISO 14882).  Older versions of GCC (3.x era?) were not compliant on this matter.

HTH,
--Eljay


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