From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17301 invoked by alias); 9 May 2007 16:19:10 -0000 Received: (qmail 17231 invoked by uid 48); 9 May 2007 16:18:56 -0000 Date: Wed, 09 May 2007 16:19:00 -0000 Subject: [Bug c++/31881] New: inherited members invisible within nested class within templated class X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "ghood at psc dot edu" 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-05/txt/msg00697.txt.bz2 Here is the code (nest.cc) that exhibits the error: template class A { public: class B { public: int i; }; class C: public B { public: void f() { this->i; // OK i; // results in "error: ‘i’ was not declared in this scope" // even though i should be inherited from B } }; }; This code generate an error when compiled with "g++ -v -save-temps -c nest.cc" on powerpc-linux-gnu using gcc 4.1.2, on i386-redhat-linux using gcc 4.1.0, and on x86_64-redhat-linux using gcc 3.4.5. This is somehow related to the classes being templated because removing the template line will eliminate the error. It compiles without problem on i386-redhat-linux using gcc 3.2.2, on x86_64-redhat-linux using PGI's pgCC 6.1.6, and on x86_64-redhat-linux using Intel's icc 9.1. -- Summary: inherited members invisible within nested class within templated class Product: gcc Version: 4.1.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: ghood at psc dot edu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31881