From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22785 invoked by alias); 3 Feb 2003 23:36:01 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 22765 invoked by uid 71); 3 Feb 2003 23:36:00 -0000 Resent-Date: 3 Feb 2003 23:36:00 -0000 Resent-Message-ID: <20030203233600.22764.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org Resent-Reply-To: gcc-gnats@gcc.gnu.org, ryan@epicgames.com Received: (qmail 20618 invoked by uid 48); 3 Feb 2003 23:30:23 -0000 Message-Id: <20030203233023.20617.qmail@sources.redhat.com> Date: Mon, 03 Feb 2003 23:36:00 -0000 From: ryan@epicgames.com Reply-To: ryan@epicgames.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/9558: subclass cannot find parent members without explicit "this->" in some cases X-SW-Source: 2003-02/txt/msg00157.txt.bz2 List-Id: >Number: 9558 >Category: c++ >Synopsis: subclass cannot find parent members without explicit "this->" in some cases >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Feb 03 23:36:00 UTC 2003 >Closed-Date: >Last-Modified: >Originator: ryan@epicgames.com >Release: unknown-1.0 >Organization: >Environment: >Description: As this is a 23-line test case with no #includes, it'll speak best for itself, but I'll comment afterwards. ...here's the preprocessed source: # 1 "x.cpp" # 1 "" # 1 "" # 1 "x.cpp" template< class T > class A { public: A() {} int important_value; }; template< class T > class B : public A { public: B() : A() { this->important_value = 10; important_value = 10; } }; int main(void) { B x(); return(0); } ...and here is the -v -save-temps output: [icculus@wickedsick ~]$ gcc -v -save-temps -o x ./x.cpp Reading specs from /usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/3.4/specs Configured with: ../gcc/configure --prefix=/usr/local/gcc-cvs Thread model: posix gcc version 3.4 20030203 (experimental) /usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -E -D__GNUG__=3 -quiet -v -D__GNUC__=3 -D__GNUC_MINOR__=4 -D__GNUC_PATCHLEVEL__=0 -D_GNU_SOURCE ./x.cpp x.ii ignoring nonexistent directory "/usr/local/gcc-cvs/i686-pc-linux-gnu/include" #include "..." search starts here: #include <...> search starts here: /usr/local/gcc-cvs/include/c++/3.4 /usr/local/gcc-cvs/include/c++/3.4/i686-pc-linux-gnu /usr/local/gcc-cvs/include/c++/3.4/backward /usr/local/include /usr/local/gcc-cvs/include /usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/3.4/include /usr/include End of search list. /usr/local/gcc-cvs/lib/gcc-lib/i686-pc-linux-gnu/3.4/cc1plus -fpreprocessed x.ii -quiet -dumpbase x.cpp -auxbase x -version -o x.s GNU C++ version 3.4 20030203 (experimental) (i686-pc-linux-gnu) compiled by GNU C version 2.95.3 20010315 (release). x.cpp: In constructor `B::B()': x.cpp:15: error: `important_value' has not been declared The important part is B::B()'s assignments to "important_value". This gives an incorrect error stating that the member is not declared unless specifically prepended with "this->". More notes: if "A" is not a template, or it uses a explicit type ("A" instead of, "A"), this error goes away, too. I assume this is just a minor detail in the new recursive-descent parser, but I'll leave real analysis to the experts. :) Thanks! --ryan. >How-To-Repeat: Compile the example file. Result is consistent in CVS from about 12 hours ago (february 2nd, 2003). >Fix: I have none at this time. >Release-Note: >Audit-Trail: >Unformatted: