This is the mail archive of the
libstdc++-prs@sources.redhat.com
mailing list for the libstdc++ project.
Re: libstdc++/94: Friends and Namespaces
- To: nobody at sourceware dot cygnus dot com
- Subject: Re: libstdc++/94: Friends and Namespaces
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: 5 Oct 2000 17:27:01 -0000
- Cc: libstdc++-prs at sourceware dot cygnus dot com,
- Reply-To: Benjamin Kosnik <bkoz at redhat dot com>
The following reply was made to PR libstdc++/94; it has been noted by GNATS.
From: Benjamin Kosnik <bkoz@redhat.com>
To: joe_hesse@actcx.com
Cc: libstdc++-gnats@sourceware.cygnus.com
Subject: Re: libstdc++/94: Friends and Namespaces
Date: Thu, 5 Oct 2000 10:17:27 -0700 (PDT)
this should be a g++ bug, not a library (libstdc++) bug. You might also
want to post on gcc-bugs@gcc.gnu.org
thanks,
benjamin
On 5 Oct 2000 joe_hesse@actcx.com wrote:
>
> >Number: 94
> >Category: libstdc++
> >Synopsis: Friends and Namespaces
> >Confidential: no
> >Severity: serious
> >Priority: medium
> >Responsible: unassigned
> >State: open
> >Class: sw-bug
> >Submitter-Id: net
> >Arrival-Date: Thu Oct 05 07:17:01 PDT 2000
> >Closed-Date:
> >Last-Modified:
> >Originator: Joseph Hesse
> >Release: gcc 2.95.??
> >Organization:
> >Environment:
> RH Linux 6.2
> >Description:
> The following code with friends and namespaces doesn't compile with gcc -c test.cpp
> The code seems ok to me and it does compile with no errors using the Comeau compiler.
> >How-To-Repeat:
> Just compile and observe the error output
> >Fix:
>
> >Release-Note:
> >Audit-Trail:
> >Unformatted:
> ----gnatsweb-attachment----
> Content-Type: text/plain; name="test.cpp"
> Content-Disposition: inline; filename="test.cpp"
>
> Does anyone know of an easy fix to make the following compile with g++.
> I think that the code is correct but it fails to compile with g++.
> The error messages are:
>
> test.cpp:10: parse error before `('
> test.cpp: In function `void f()':
> test.cpp:7: `int N::XYZ::m_x' is private
> test.cpp:17: within this context
>
> The code compiles with the online Comeau compiler.
>
> -----------------------------------------------
> void f();
>
> namespace N {
>
> class XYZ {
> private:
> int m_x;
> public:
> XYZ(int u = 0) : m_x(u) {}
> friend void ::f();
> };
>
> } // end of namespace N
>
> void f() {
> N::XYZ a(10);
> a.m_x = 11;
> }
> -----------------------------------------------
>