Package: gcc-3.4 Version: 3.4.0-2 Severity: important Tags: experimental Consider this code fragment:
template <class T> class A { protected: int f; }; template <class T> class B: public A<T> { public: B() { f = 1; // line 14 } }; gcc-3.3 has no problem with this, but gcc-3.4 complains as follows: a.cc: In constructor `B<T>::B()': a.cc:14: error: `f' undeclared (first use this function) a.cc:14: error: (Each undeclared identifier is reported only once for each function it appears in.) Changing f on line 14 to any of this->f, B<T>::f, or A<T>::f works around the problem. There is also no problem if either B or A is not templated. I am unable to find anything in the C++ specification that indicates that gcc 3.4's behavior is correct, but it's hard to find things in the C++ spec! As far as I know, there are no circumstances under which fully qualifying a name is required when there is only one candidate in the scope. The fact that A and B are both templated does not change the fact that "f" is a protected member variable of the parent class. I have NOT reported this upstream as the only version of gcc-3.4 that I've tried is the one in experimental. This bug is related to bug 245368. If the gcc people agree that this is a bug, I will merge that bug with this one. (There someone reported that xerces23 fails to compile with gcc 3.4. The compiler errors were of this nature.) Gratuitous comment: it's great to see g++ 3.4 in experimental. It will be easier for me to test my complex C++ software against it than ever before. Thanks. :-) -- Jay Berkenbilt <[EMAIL PROTECTED]> http://www.ql.org/q/ -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.4.26-1-686-smp Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 Versions of packages gcc-3.4 depends on: ii binutils 2.14.90.0.7-6 The GNU assembler, linker and bina ii cpp-3.4 3.4.0-2 The GNU C preprocessor ii gcc-3.4-base 3.4.0-2 The GNU Compiler Collection (base ii libc6 2.3.2.ds1-12 GNU C Library: Shared libraries an ii libgcc1 1:3.4.0-2 GCC support library -- no debconf information