From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 25054 invoked by alias); 4 Dec 2002 18: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 25023 invoked by uid 71); 4 Dec 2002 18:36:01 -0000 Resent-Date: 4 Dec 2002 18:36:01 -0000 Resent-Message-ID: <20021204183601.25022.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, Boris.Maric@consol.de Received: (qmail 23117 invoked by uid 61); 4 Dec 2002 18:33:44 -0000 Message-Id: <20021204183344.23116.qmail@sources.redhat.com> Date: Wed, 04 Dec 2002 10:36:00 -0000 From: Boris.Maric@consol.de Reply-To: Boris.Maric@consol.de To: gcc-gnats@gcc.gnu.org X-Send-Pr-Version: gnatsweb-2.9.3 (1.1.1.1.2.31) Subject: c++/8813: members of a nested class should not have special access to members of an enclosing class X-SW-Source: 2002-12/txt/msg00230.txt.bz2 List-Id: >Number: 8813 >Category: c++ >Synopsis: members of a nested class should not have special access to members of an enclosing class >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Wed Dec 04 10:36:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Boris.Maric@consol.de >Release: gcc Version 2.95.2 3.2 and probably others >Organization: >Environment: Solaris 8 and Solaris 2.6 and probably others >Description: Testcase: maric@kanada >uname -a SunOS kanada 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-5_10 maric@kanada >cat test.C class enclosing { public: enclosing (void); protected: static int i; class nested {public: void f(){i=0;}}; }; this code compiles without error and without warnings. According to ISO/IEC 14882 (C++ Standard) enclosing::nested::f() as a member of nested should not have special access to i which is a protected member of enclosing. Output from gcc 2.95: maric@kanada >gcc -Wall -v -c -o /dev/null test.C Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/specs gcc version 2.95.2 19991024 (release) /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -Wall -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) test.C /var/tmp/ccZAIybg.ii GNU CPP version 2.95.2 19991024 (release) (sparc) #include "..." search starts here: #include <...> search starts here: /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3 /usr/local/include /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../sparc-sun-solaris2.8/include /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/include /usr/include End of search list. The following default directories have been omitted from the search path: End of omitted list. /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/cc1plus /var/tmp/ccZAIybg.ii -quiet -dumpbase test.cc -Wall -version -o /var/tmp/ccCBs8Iq.s GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.8) compiled by GNU C version 2.95.2 19991024 (release). /usr/ccs/bin/as -V -Qy -s -o /dev/null /var/tmp/ccCBs8Iq.s /usr/ccs/bin/as: Sun WorkShop 6 99/08/18 gcc 3.2 on Solaris 2.6 shows the same behaviour >How-To-Repeat: compile the following testcase: class enclosing { public: enclosing (void); protected: static int i; class nested {public: void f(){i=0;}}; }; >Fix: >Release-Note: >Audit-Trail: >Unformatted: