From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22861 invoked by alias); 21 Feb 2007 12:22:09 -0000 Received: (qmail 22828 invoked by uid 48); 21 Feb 2007 12:21:58 -0000 Date: Wed, 21 Feb 2007 12:22:00 -0000 Subject: [Bug c++/30909] New: public member of template class not visible in derived template class X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "sl at datamyway dot de" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2007-02/txt/msg02446.txt.bz2 on SuSe linux 10.0 ~/wurschtel/cpp> uname -a Linux djebe 2.6.13-15-smp #1 SMP Tue Sep 13 14:56:15 UTC 2005 i686 i686 i386 GNU/Linux with gcc version 4.0.2 (but also with 4.1.2) when running make on the following files A.h: //const int NUM_BYTES = 5; template class A { public: int mBytes[NUM_BYTES]; }; ----- B.h: #include "A.h" template class B : public A { public: int blee() { mBytes[0]++; return mBytes[0]; }; }; ----- x.cpp: #include "A.h" template class B : public A { public: int blee() { mBytes[0]++; return mBytes[0]; }; }; ----- makefie: #include "A.h" template class B : public A { public: int blee() { mBytes[0]++; return mBytes[0]; }; }; ----- I get compile errors: ~/wurschtel/cpp> make rm -f x g++ -ansi -pedantic -Wall -o x x.cpp B.h: In member function ‘int B::blee()’: B.h:9: error: ‘mBytes’ was not declared in this scope make: *** [x] Error 1 --- when the templates are changed to classes and the template parameter is declared as constant everything compiles and runs ok. On older linux running g++ version 2.95.2 everything compiles and runs ok. Sorry if this report is duplicate, i filed it yesterday along with 30893 but cannot find it today so I assume commit failed. -- Summary: public member of template class not visible in derived template class Product: gcc Version: 4.0.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: sl at datamyway dot de http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30909