public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/31454] New: "protected" protects againt derived class
@ 2007-04-03 2:51 igodard at pacbell dot net
2007-04-03 3:37 ` [Bug c++/31454] " pinskia at gcc dot gnu dot org
0 siblings, 1 reply; 2+ messages in thread
From: igodard at pacbell dot net @ 2007-04-03 2:51 UTC (permalink / raw)
To: gcc-bugs
The code:
struct base {
protected:
virtual void foo() {}
};
struct der : public base {
virtual void foo() { p->foo(); }
base* p;
};
gets you:
~/ootbc/sim/test$ g++ foo.cc
foo.cc: In member function 'virtual void der::foo()':
foo.cc:3: error: 'virtual void base::foo()' is protected
foo.cc:7: error: within this context
--
Summary: "protected" protects againt derived class
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: igodard at pacbell dot net
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31454
^ permalink raw reply [flat|nested] 2+ messages in thread
* [Bug c++/31454] "protected" protects againt derived class
2007-04-03 2:51 [Bug c++/31454] New: "protected" protects againt derived class igodard at pacbell dot net
@ 2007-04-03 3:37 ` pinskia at gcc dot gnu dot org
0 siblings, 0 replies; 2+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2007-04-03 3:37 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-04-03 04:36 -------
This is not a bug. You are allowed to call protected functions on this but
nobody elses.
This has nothing to do with derived class or not. This is just how C++ works.
--
pinskia at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31454
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2007-04-03 3:37 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-03 2:51 [Bug c++/31454] New: "protected" protects againt derived class igodard at pacbell dot net
2007-04-03 3:37 ` [Bug c++/31454] " pinskia at gcc dot gnu dot org
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).