This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/19868] New: error for legal friend statement ?
- From: "dcb314 at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 9 Feb 2005 20:05:53 -0000
- Subject: [Bug c++/19868] New: error for legal friend statement ?
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Hello there,
Give the following C++ code
class A
{
private:
void f();
};
class B
{
private:
friend void A :: f();
};
then g++ 3.4.2 and g++ 3.4 snapshot 20050128 say
[dcb@localhost Alphasrc]$ ~/gnu/20050128/results/bin/g++ -c friend2.cc
friend2.cc:5: error: `void A::f()' is private
friend2.cc:11: error: within this context
I checked a couple of other C++ compilers, and they were happy with
the code.
I checked Stroustrup 3, section 11.5, page 279 in my copy. He has similar
code, and he appears to claim that the code should be ok.
Would I be correct in thinking that the definition of the language has
recently changed in this area ?
--
Summary: error for legal friend statement ?
Product: gcc
Version: 3.4.4
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dcb314 at hotmail dot com
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: linux-i686-pc-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19868