public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/39905] New: static downcast through protectedly inherited base class rejected
@ 2009-04-26 0:27 fang at csl dot cornell dot edu
2009-04-26 0:42 ` [Bug c++/39905] " pinskia at gcc dot gnu dot org
2009-04-26 0:52 ` fang at csl dot cornell dot edu
0 siblings, 2 replies; 3+ messages in thread
From: fang at csl dot cornell dot edu @ 2009-04-26 0:27 UTC (permalink / raw)
To: gcc-bugs
The following test case was accepted in g++-4.3.x and earlier, but rejected by
4.4.0.
Code is possibly invalid, can any standard-fluent experts comment?
// prNEW.cc -- test case
class base {
protected:
void
foo(void) const;
};
class derived : protected base {
public:
void
bar(void) const {
base::foo();
}
};
void
base::foo(void) const {
static_cast<const derived&>(*this);
}
% g++-4 -ansi -pedantic-errors -Wold-style-cast -Woverloaded-virtual -W -Wextra
-Wall -Wundef -Wshadow -Wno-unused-parameter -Wpointer-arith -Wcast-qual
-Wcast-align -Wconversion -Werror -std=c++0x -Wno-error=conversion -g -O3
-Wno-long-long -c prNEW.cc -o prNEW.o
prNEW.cc: In member function 'void base::foo() const':
prNEW.cc:17: error: 'base' is an inaccessible base of 'derived'
VERY closely related to pr12265, the only real change is from private to
protected inherited base.
--
Summary: static downcast through protectedly inherited base class
rejected
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: fang at csl dot cornell dot edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39905
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/39905] static downcast through protectedly inherited base class rejected
2009-04-26 0:27 [Bug c++/39905] New: static downcast through protectedly inherited base class rejected fang at csl dot cornell dot edu
@ 2009-04-26 0:42 ` pinskia at gcc dot gnu dot org
2009-04-26 0:52 ` fang at csl dot cornell dot edu
1 sibling, 0 replies; 3+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2009-04-26 0:42 UTC (permalink / raw)
To: gcc-bugs
------- Comment #1 from pinskia at gcc dot gnu dot org 2009-04-26 00:42 -------
Comment #1 in Bug 12265, explains exactly why this code is invalid. Protected
base classes are non accessible in other clases besides in derived and derived
classes of derived.
--
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=39905
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug c++/39905] static downcast through protectedly inherited base class rejected
2009-04-26 0:27 [Bug c++/39905] New: static downcast through protectedly inherited base class rejected fang at csl dot cornell dot edu
2009-04-26 0:42 ` [Bug c++/39905] " pinskia at gcc dot gnu dot org
@ 2009-04-26 0:52 ` fang at csl dot cornell dot edu
1 sibling, 0 replies; 3+ messages in thread
From: fang at csl dot cornell dot edu @ 2009-04-26 0:52 UTC (permalink / raw)
To: gcc-bugs
------- Comment #2 from fang at csl dot cornell dot edu 2009-04-26 00:52 -------
Subject: Re: static downcast through protectedly inherited
base class rejected
> ------- Comment #1 from pinskia at gcc dot gnu dot org 2009-04-26 00:42 -------
> Comment #1 in Bug 12265, explains exactly why this code is invalid.
> Protected base classes are non accessible in other clases besides in
> derived and derived classes of derived.
Ok, I get it. "not accessible to classes besides ..." excludes the
base class itself.
I see your reflex time has not slowed, pinski. :)
Fang
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39905
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-04-26 0:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-04-26 0:27 [Bug c++/39905] New: static downcast through protectedly inherited base class rejected fang at csl dot cornell dot edu
2009-04-26 0:42 ` [Bug c++/39905] " pinskia at gcc dot gnu dot org
2009-04-26 0:52 ` fang at csl dot cornell dot edu
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).