From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7813 invoked by alias); 7 May 2003 17: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 7790 invoked by uid 71); 7 May 2003 17:36:01 -0000 Resent-Date: 7 May 2003 17:36:01 -0000 Resent-Message-ID: <20030507173601.7789.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, bwood@emc.com Received: (qmail 1772 invoked by uid 48); 7 May 2003 17:28:50 -0000 Message-Id: <20030507172850.1771.qmail@sources.redhat.com> Date: Wed, 07 May 2003 17:36:00 -0000 From: bwood@emc.com Reply-To: bwood@emc.com To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/10668: nested class looks for member variable rather than object X-SW-Source: 2003-05/txt/msg00487.txt.bz2 List-Id: >Number: 10668 >Category: c++ >Synopsis: nested class looks for member variable rather than object >Confidential: no >Severity: non-critical >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed May 07 17:36:01 UTC 2003 >Closed-Date: >Last-Modified: >Originator: Bob Wood (bwood@emc.com) >Release: gcc-3.2.3 >Organization: >Environment: Solaris 8 >Description: When the attached file is compiled with g++, I get this error: test.cpp: In constructor 'c1::c2::c2()': test.cpp:10: 'class c1::c2' has no member named 'i' If I remove the line commented "remove for success", no error results. Because c1::c2 has no access to c1::i, I would expect the compiler to simply reference the global variable i, as it does when the commented line is removed. >How-To-Repeat: g++ test.cpp >Fix: >Release-Note: >Audit-Trail: >Unformatted: ----gnatsweb-attachment---- Content-Type: text/plain; name="test.cpp" Content-Disposition: inline; filename="test.cpp" int i; class c1 { public: int i; friend class c2; class c2 { public: int* y; c2() { y = &i; }; }; c2 z; };