Issue with pointer redirection in inherited clauses

Ian Lance Taylor iant@google.com
Wed May 6 05:59:00 GMT 2009


Tyler Earman <rem.intellegare@gmail.com> writes:

> "I have noticed that when (this is C++) inheriting a templatized derived
> class from a templatized base that in g++, references to elements of the
> base class have to be qualified with this-> or with the name of the base
> class put in front.  But this is NOT needed in the Windows C++ compilers
> so far as I can see.  For example, Queue<T> might have a rep and a size
> in it; and Deque<T> can be setup to inherit from Queue<T> and where it
> references rep, it has to be this->rep.  But with the Windows compilers,
> just rep works in the derived class."

This is two-phase lookup, q.v.  The Windoes C++ compilers apparently do
not implement it correctly.

Ian



More information about the Gcc-help mailing list