GCC 3.4.0 and template type resolution bug

Rene Rebe rene@rocklinux-consulting.de
Thu Apr 29 07:53:00 GMT 2004


Hi,

compiling one of our C++ projects I found a quite strange behaviour
(==bug?) of gcc-3.4.0. 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,
too. Although it does work with normal classes. (Of course the code
does compile with earlier version of GCC - such as 3.2.3.)


  template <typename INFO>
  class Basic
  {
  protected:

    INFO* m_info;
  };

  template <typename INFO>
  class Std : public Basic <INFO>
  {
  public:

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

  class Normal : public Basic <int>
  {
  public:
    bool testMe () { return m_info != 0; }
  };

int main () {
  return 0;
}

The error is:

gcc34-template.cc: In member function `bool Std<INFO>::testMe()':
gcc34-template.cc:15: error: `m_info' undeclared (first use this function)
gcc34-template.cc:15: error: (Each undeclared identifier is reported only once for each function it appears in.)

Sincerely yours,
  René Rebe
    - ROCK Linux stable release maintainer

--  
René Rebe - Europe/Germany/Berlin
  rene@rocklinux.org rene@rocklinux-consulting.de
http://www.rocklinux.org http://www.rocklinux-consulting.de



More information about the Gcc mailing list