From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9412 invoked by alias); 31 Jan 2002 11:06:02 -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 9354 invoked by uid 71); 31 Jan 2002 11:06:01 -0000 Resent-Date: 31 Jan 2002 11:06:01 -0000 Resent-Message-ID: <20020131110601.9353.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 Resent-Reply-To: gcc-gnats@gcc.gnu.org, rabid@ringrows.ru Received:(qmail 6653 invoked from network); 31 Jan 2002 10:56:44 -0000 Received: from unknown (HELO rabid.office) (212.5.177.66) by sources.redhat.com with SMTP; 31 Jan 2002 10:56:44 -0000 Received: by rabid.office (Postfix on SuSE Linux 7.2 (i386), from userid 1024) id 5287F8CEDD; Thu, 31 Jan 2002 13:56:37 +0300 (MSK) Message-Id:<20020131105637.5287F8CEDD@rabid.office> Date: Thu, 31 Jan 2002 03:06:00 -0000 From: Konstantin Osipov Reply-To: rabid@ringrows.ru To: gcc-gnats@gcc.gnu.org Cc: rabid@ringrows.ru X-Send-Pr-Version:3.113 Subject: c++/5551: g++ 3.0.3 friends and nested classes: fail to compile X-SW-Source: 2002-01/txt/msg01075.txt.bz2 List-Id: >Number: 5551 >Category: c++ >Synopsis: nested classess, private constructors, and friends: fail to compile >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: rejects-legal >Submitter-Id: net >Arrival-Date: Thu Jan 31 03:06:01 PST 2002 >Closed-Date: >Last-Modified: >Originator: Konstantin Osipov >Release: 3.0.3 >Organization: >Environment: glibc 2.2.4, Suse Linux 7.2 System: Linux rabid 2.4.16 #1 Thu Jan 3 22:52:25 MSK 2002 i686 unknown Architecture: i686 host: i686-pc-linux-gnu build: i686-pc-linux-gnu target: i686-pc-linux-gnu configured with: ./configure >Description: Here is the source: --cut class Info { friend class Creator; Info(); struct InfoRep; InfoRep *_rep; }; struct Info::InfoRep { char _data[16]; }; Info::Info() :_rep(new InfoRep) {} class Outer { friend class Creator; Outer(Info *info); struct OuterRep; OuterRep *_rep; }; struct Outer::OuterRep { Info* _info; OuterRep(Info *info); }; Outer::OuterRep::OuterRep(Info *info) :_info(info) {} Outer::Outer(Info *info) :_rep(new OuterRep(info)) {} class Creator { public: Creator(); }; Creator::Creator() { Info info; Outer outer(&info); } int main(int argc, char *argv[]) { Creator c; } --cut Here is the compiler outputd@rabid:/home/rabid> g++ test.cc test.cc:10: `struct Info::InfoRep' is private test.cc:22: within this context rabid@rabid:/home/rabid> >How-To-Repeat: compile it. >Fix: If I move line 'friend class Creator;' in class Outer after the declaration of struct OuterRep everything compiles OK: --cut class Outer { Outer(Info *info); struct OuterRep; OuterRep *_rep; friend class Creator; }; --cut >Release-Note: >Audit-Trail: >Unformatted: