GCC 3.4.0 and template type resolution bug

Vladimir Prus ghost@cs.msu.su
Thu Apr 29 09:08:00 GMT 2004


Rene Rebe wrote:

> The 3.4.0 version is not able to deduce m_info
> in the base template class's when the inherited class is a template,

>   template <typename INFO>
>   class Std : public Basic <INFO>
>   {
>   public:
> 
>     bool testMe () { return m_info != 0; }
>   };

I think it's called "2-phase lookup". The "m_info" name is non-dependent, so
it's looked up at the time template declaration is parsed, and names from
Basic are not used (in fact, you can later declare 10 specialization of
Basic, all with different members).

To make the example compile, just make the name dependendent by using

    bool testMe () { return this->m_info != 0; }

gcc 3.4 is the first version which implements 2-phase lookup, that's why you
did not get any problems with previous versions.

- Volodya




More information about the Gcc mailing list