This is the mail archive of the
mailing list for the GCC project.
RE: Deriving from templated classes
- From: "John (Eljay) Love-Jensen" <eljay at adobe dot com>
- To: "Lothar Braun" <lothar at lobraun dot de>, <gcc-help at gcc dot gnu dot org>
- Date: Fri, 16 Nov 2007 07:31:11 -0800
- Subject: RE: Deriving from templated classes
- References: <firstname.lastname@example.org>
>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.