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: Template base class: name lookup bug?


 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.


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