RE: Template base class: name lookup bug?

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

 



 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 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