From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15536 invoked by alias); 11 Feb 2002 20:46:04 -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 15458 invoked by uid 71); 11 Feb 2002 20:46:02 -0000 Resent-Date: 11 Feb 2002 20:46:01 -0000 Resent-Message-ID: <20020211204601.15457.qmail@sources.redhat.com> Resent-From: gcc-gnats@gcc.gnu.org (GNATS Filer) Resent-To: nobody@gcc.gnu.org Resent-Cc: gcc-prs@gcc.gnu.org, gcc-bugs@gcc.gnu.org, matzmich@cs.tu-berlin.de Resent-Reply-To: gcc-gnats@gcc.gnu.org, pcarlini@unitus.it Received:(qmail 11242 invoked by uid 61); 11 Feb 2002 20:41:00 -0000 Message-Id:<20020211204100.11240.qmail@sources.redhat.com> Date: Mon, 11 Feb 2002 12:46:00 -0000 From: pcarlini@unitus.it Reply-To: pcarlini@unitus.it To: gcc-gnats@gcc.gnu.org Cc: matzmich@cs.tu-berlin.de X-Send-Pr-Version:gnatsweb-2.9.3 (1.1.1.1.2.31) X-GNATS-Notify:matzmich@cs.tu-berlin.de Subject: c++/5659: default access for class/struct bug X-SW-Source: 2002-02/txt/msg00262.txt.bz2 List-Id: >Number: 5659 >Category: c++ >Synopsis: default access for class/struct bug >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Mon Feb 11 12:46:00 PST 2002 >Closed-Date: >Last-Modified: >Originator: Michael Matz / Paolo Carlini >Release: g++ (GCC) 3.1 20020209 (experimental) >Organization: >Environment: i686-pc-linux-gnu >Description: look at this: ---- snip ----- class Outer { private: #if 1 class Inner; #else struct Inner; #endif Inner *i; public: void pub(); }; struct Outer::Inner { Inner(int i) : mem(i) {} int mem; }; void Outer::pub() { i = new Inner(42); } ---- snap ----- Notice how Outer::Inner is once declared with 'class', once with 'struct', but defined with 'struct' in evry case. The current HEAD thinks: access.cpp:14: `Outer::Inner::Inner(int)' is private access.cpp:20: within this context (when it's changed to #if 0 it of course works). Now the standard says (if we read it correctly) (11.2), that the default access right of members depends on the _definition_ not declaration of a class. >How-To-Repeat: -gcc3.0.x compiles the testcase just fine, as EDG-based compilers do. -In such cases some compilers warn about "inconsistent use of class/struct keywords". >Fix: >Release-Note: >Audit-Trail: >Unformatted: