c++/7522: access by friend function's default argument

Christoph Ludwig cludwig@cdc.informatik.tu-darmstadt.de
Wed Aug 7 05:46:00 GMT 2002


>Number:         7522
>Category:       c++
>Synopsis:       access by friend function's default argument
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Wed Aug 07 05:46:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Christoph Ludwig <cludwig@cdc.informatik.tu-darmstadt.de>
>Release:        gcc version 3.1
>Organization:
>Environment:
Linux 2.4.10-4GB i686 (SuSE 7.3)
>Description:
g++ 3.1 rejects access to a private class member by the
default argument of a friend function.

But clause 11, paragraph 7, of the C++ standard seems to
allow the access.

g++ -v gives the following:
  Reading specs from /home/lidiaadm/gcc-3.1/gcc-3.1/lib/gcc-lib/i686-pc-linux-gnu/3.1/specs
  Configured with: ./configure --prefix=/home/lidiaadm/gcc-3.1/gcc-3.1 --enable-threads=posix --enable-languages=c,c++
  Thread model: posix
  gcc version 3.1

gcc 3.0.3 and 2.95.3 (Linux/i) as well as 2.95.2 
(Solaris 8 / UltraSparc) show the same behaviour.

Regards

Christoph Ludwig
>How-To-Repeat:
g++ -c friend_default.cc
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="friend_default.cc"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="friend_default.cc"

Y2xhc3MgQSB7CnByaXZhdGU6CiAgICBzdGF0aWMgY29uc3QgaW50IGRhdGE7CiAgICAKICAgIGZy
aWVuZCBpbnQgZihpbnQpOwp9OwoKY29uc3QgaW50IEE6OmRhdGEgPSA1OwoKaW50IGYoaW50IGQg
PSBBOjpkYXRhKSB7Cn0KCg==



More information about the Gcc-bugs mailing list