RE: Deriving from templated classes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux