public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* c++/9061: Improper access granted to protected typedef from nested member of derived class
@ 2002-12-26 12:46 chris
0 siblings, 0 replies; 2+ messages in thread
From: chris @ 2002-12-26 12:46 UTC (permalink / raw)
To: gcc-gnats
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1523 bytes --]
>Number: 9061
>Category: c++
>Synopsis: Improper access granted to protected typedef from nested member of derived class
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Dec 26 12:46:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator: chris@pennasoft.com
>Release: 2.95.4
>Organization:
>Environment:
FreeBSD topperwein.pennasoft.com 4.7-STABLE FreeBSD 4.7-STABLE #0: Wed Dec 4 15:59:17 EST 2002 behanna@topperwein.pennasoft.com:/raid0/stable/usr/obj/raid0/stable/usr/src/sys/TOPPERWEIN i386
>Description:
Consider the following:
class Parent {
protected:
typedef int MyInt;
};
class Child: public Parent {
protected:
class Nested {
public:
inline MyInt myfunc() { return 0; }
};
};
class Nested is not a derived class of class Parent, and thus should not have access to any protected members of class Parent, per the 1997 C++ draft standard, section 11.8, paragraph 1 (see http://anubis.dkuug.dk/jtc1/sc22/open/n2356/access.html ).
g++ version 2.95.4 allows the above construct. By way of contrast, Sun's Forté C++ compiler, version 6.2, does not, and issues the complaint:
"prot.C", line 10: Error: Parent::MyInt is not accessible from Child::Nested.
1 Error(s) detected.
>How-To-Repeat:
Save the code example as prot.C and compile it as follows:
g++ -c prot.C
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: c++/9061: Improper access granted to protected typedef from nested member of derived class
@ 2003-01-06 22:40 bangerth
0 siblings, 0 replies; 2+ messages in thread
From: bangerth @ 2003-01-06 22:40 UTC (permalink / raw)
To: chris, gcc-bugs, gcc-prs, nobody
Synopsis: Improper access granted to protected typedef from nested member of derived class
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Mon Jan 6 14:40:44 2003
State-Changed-Why:
The standard was clarified and now states that member classes
have all the same rights as member functions of a class. This
rule applies here.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9061
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2003-01-06 22:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-12-26 12:46 c++/9061: Improper access granted to protected typedef from nested member of derived class chris
2003-01-06 22:40 bangerth
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).