This simple C++ program gives the following error which seems strange to me. GCC 3.3.1 compiles it fine. $ g++ -W -Wall -o test test.cxx test.cxx: In member function `void B<T>::foo(int)': test.cxx:14: error: `x' undeclared (first use this function) test.cxx:14: error: (Each undeclared identifier is reported only once for each f unction it appears in.) ----8<---------- template <typename T> class A { protected: int x; }; template <typename T> class B : public A<T> { public: void foo (int _x) { x = _x; } }; int main () { B<int> b; b.foo(1); return 0; } ----8<---------- GCC is: Reading specs from /usr/local/lib/gcc/i686-pc-cygwin/3.4/specs Configured with: ../srcdir/configure --enable-languages=c,c++ --enable-threads=p osix --enable-version-specific-runtime-libs --enable-dwarf2 --with-cpu=athlon -- with-arch=athlon --without-included-gettext Thread model: posix gcc version 3.4 20031108 (experimental)
Can you read <http://gcc.gnu.org/gcc-3.4/changes.html>, GCC is correct to reject this code.
There's also a longer section in the non-bugs part of the manual that explains what exactly is going on here. W.
*** Bug 25783 has been marked as a duplicate of this bug. ***
*** Bug 24960 has been marked as a duplicate of this bug. ***
*** Bug 23976 has been marked as a duplicate of this bug. ***
*** Bug 23908 has been marked as a duplicate of this bug. ***
*** Bug 23755 has been marked as a duplicate of this bug. ***
*** Bug 23735 has been marked as a duplicate of this bug. ***
*** Bug 22588 has been marked as a duplicate of this bug. ***
*** Bug 16709 has been marked as a duplicate of this bug. ***
*** Bug 16577 has been marked as a duplicate of this bug. ***
*** Bug 16067 has been marked as a duplicate of this bug. ***
*** Bug 15372 has been marked as a duplicate of this bug. ***
*** Bug 15111 has been marked as a duplicate of this bug. ***
*** Bug 14376 has been marked as a duplicate of this bug. ***
*** Bug 15552 has been marked as a duplicate of this bug. ***
*** Bug 25827 has been marked as a duplicate of this bug. ***
*** Bug 25846 has been marked as a duplicate of this bug. ***