GCC 3.4.0 and template type resolution bug (no)
Michael Veksler
VEKSLER@il.ibm.com
Thu Apr 29 08:04:00 GMT 2004
gcc-3.4 is correct (gcc-3.2 was buggy). Please read gcc-3.4 release notes.
You should use this->m_info, otherwise the compiler will look for m_info
outside your classes,
Rene Rebe <rene@rocklinux-consulting.de>
Sent by: gcc-owner@gcc.gnu.org
29/04/2004 09:12
To: gcc@gcc.gnu.org
cc: valentin@rocklinux-consulting.de
Subject: GCC 3.4.0 and template type resolution bug
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