public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c++/8813: members of a nested class should not have special access to members of an enclosing class
@ 2002-12-04 11:03 bangerth
  0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2002-12-04 11:03 UTC (permalink / raw)
  To: Boris.Maric, gcc-bugs, gcc-prs, nobody

Synopsis: members of a nested class should not have special access to members of an enclosing class

State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Wed Dec  4 11:03:01 2002
State-Changed-Why:
    There is a defect report to the C++ standard that treats this.
    The resolution is that the elements of member classes have
    the same access as member functions, for example, so they
    can also access private members of the enclosing class.
    I personally don't like this resolution, but it is there
    and is part of the C++ standard.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8813


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c++/8813: members of a nested class should not have special access to members of an enclosing class
@ 2002-12-04 10:36 Boris.Maric
  0 siblings, 0 replies; 2+ messages in thread
From: Boris.Maric @ 2002-12-04 10:36 UTC (permalink / raw)
  To: gcc-gnats


>Number:         8813
>Category:       c++
>Synopsis:       members of a nested class should not have special access to members of an enclosing class
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Dec 04 10:36:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Boris.Maric@consol.de
>Release:        gcc Version 2.95.2 3.2 and probably others
>Organization:
>Environment:
Solaris 8 and Solaris 2.6 and probably others
>Description:
Testcase:

maric@kanada >uname -a
SunOS kanada 5.8 Generic_108528-16 sun4u sparc SUNW,Ultra-5_10

maric@kanada >cat test.C
class enclosing
{
public:
  enclosing (void);

protected:
  static int i;
  class nested {public: void f(){i=0;}};
};

this code compiles without error and without warnings.
According to ISO/IEC 14882 (C++ Standard) enclosing::nested::f() as a member of nested should not have special access to i which is a protected member of enclosing.

Output from gcc 2.95:

maric@kanada >gcc -Wall -v -c -o /dev/null test.C
Reading specs from /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/specs
gcc version 2.95.2 19991024 (release)
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -Dsparc -Dsun -Dunix -D__svr4__ -D__SVR4 -D__sparc__ -D__sun__ -D__unix__ -D__svr4__ -D__SVR4 -D__sparc -D__sun -D__unix -Asystem(unix) -Asystem(svr4) -D__EXCEPTIONS -Wall -D__GCC_NEW_VARARGS__ -Acpu(sparc) -Amachine(sparc) test.C /var/tmp/ccZAIybg.ii
GNU CPP version 2.95.2 19991024 (release) (sparc)
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../include/g++-3
 /usr/local/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/../../../../sparc-sun-solaris2.8/include
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/include
 /usr/include
End of search list.
The following default directories have been omitted from the search path:
End of omitted list.
 /usr/local/lib/gcc-lib/sparc-sun-solaris2.8/2.95.2/cc1plus /var/tmp/ccZAIybg.ii -quiet -dumpbase test.cc -Wall -version -o /var/tmp/ccCBs8Iq.s
GNU C++ version 2.95.2 19991024 (release) (sparc-sun-solaris2.8) compiled by GNU C version 2.95.2 19991024 (release).
 /usr/ccs/bin/as -V -Qy -s -o /dev/null /var/tmp/ccCBs8Iq.s
/usr/ccs/bin/as: Sun WorkShop 6 99/08/18


gcc 3.2 on Solaris 2.6 shows the same behaviour









>How-To-Repeat:
compile the following testcase:

class enclosing
{
public:
  enclosing (void);

protected:
  static int i;
  class nested {public: void f(){i=0;}};
};
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2002-12-04 19:03 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-04 11:03 c++/8813: members of a nested class should not have special access to members of an enclosing class bangerth
  -- strict thread matches above, loose matches on Subject: below --
2002-12-04 10:36 Boris.Maric

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).