Template base class: name lookup bug?

Kaz Kylheku kaz@zeugmasystems.com
Sat Nov 4 00:05:00 GMT 2006


 Kaz Kylheku wrote:
> #include <cstdio>
> 
> template <class T>
> class Base {
>     protected:
>         int numberBase;
> };
> 
> template <class T>
> class Derived : public Base<T> {
> public:
>     void print()
>     {
>         printf("bn = %d\n", numberBase);
>     }
> };
> 
> int main()
> {
>     Derived<int> d;
>     d.print();
>     return 0;
> }


New discovery: simply changing it to ``this->numberBase'' gets rid of
the error.

I forgot to mention that the latest version with which I reproduced this
is GCC 4.1.1.



More information about the Gcc-help mailing list