public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/12265] New: Downcast to class which derives privately rejected
@ 2003-09-12 16:36 olau at hardworking dot dk
2003-09-12 17:14 ` [Bug c++/12265] " nathan at gcc dot gnu dot org
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: olau at hardworking dot dk @ 2003-09-12 16:36 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12265
Summary: Downcast to class which derives privately rejected
Product: gcc
Version: 3.3.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: olau at hardworking dot dk
CC: gcc-bugs at gcc dot gnu dot org
Given the source
class Base {
public:
int x;
void f();
};
class Derived: private Base { };
void Base::f()
{
static_cast<const Derived&>(*this);
}
GCC says
$ g++ t1.c++ -o t1 -Wall
t1.c++: I member function 'void Base::f()':
t1.c++:11: error: `Base' is an inaccessible base of `Derived'
But as far as I know, that code is legal (I may be wrong). The C++ wrapper of
GTK+, gtkmm, uses such code and now doesn't work. Previous releases of GCC were
fine. The precise version of GCC is:
$ gcc-3.3 --version
gcc-3.3 (GCC) 3.3.2 20030908 (Debian prerelease)
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/12265] Downcast to class which derives privately rejected
2003-09-12 16:36 [Bug c++/12265] New: Downcast to class which derives privately rejected olau at hardworking dot dk
@ 2003-09-12 17:14 ` nathan at gcc dot gnu dot org
2003-09-13 16:51 ` olau at hardworking dot dk
2005-09-13 14:09 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: nathan at gcc dot gnu dot org @ 2003-09-12 17:14 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12265
nathan at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
------- Additional Comments From nathan at gcc dot gnu dot org 2003-09-12 16:46 -------
not a bug. the cast is invalid. [5.2.9]/5 says it is ok if there's a
standard conversion from derived to base.[4.10]/3 says there's a conversion,
but if the base is inaccessible or ambiguous, the program is ill-formed.
[11.2]/4 says a base is accessible if an invented public member of the base
class is accessible. members of Base, such as Base::f have no special
access to the provate bases of Derived, so the base is inaccessible in
Base::f. If the cast were in a member or friend of Derived, it would be ok.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/12265] Downcast to class which derives privately rejected
2003-09-12 16:36 [Bug c++/12265] New: Downcast to class which derives privately rejected olau at hardworking dot dk
2003-09-12 17:14 ` [Bug c++/12265] " nathan at gcc dot gnu dot org
@ 2003-09-13 16:51 ` olau at hardworking dot dk
2005-09-13 14:09 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: olau at hardworking dot dk @ 2003-09-13 16:51 UTC (permalink / raw)
To: gcc-bugs
PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12265
------- Additional Comments From olau at hardworking dot dk 2003-09-13 13:53 -------
OK, I'm sorry. I don't have a copy of the standard so I couldn't check. The
rules seem a little odd.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [Bug c++/12265] Downcast to class which derives privately rejected
2003-09-12 16:36 [Bug c++/12265] New: Downcast to class which derives privately rejected olau at hardworking dot dk
2003-09-12 17:14 ` [Bug c++/12265] " nathan at gcc dot gnu dot org
2003-09-13 16:51 ` olau at hardworking dot dk
@ 2005-09-13 14:09 ` pinskia at gcc dot gnu dot org
2 siblings, 0 replies; 4+ messages in thread
From: pinskia at gcc dot gnu dot org @ 2005-09-13 14:09 UTC (permalink / raw)
To: gcc-bugs
------- Additional Comments From pinskia at gcc dot gnu dot org 2005-09-13 14:09 -------
*** Bug 23849 has been marked as a duplicate of this bug. ***
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |fang at csl dot cornell dot
| |edu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12265
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2005-09-13 14:09 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-09-12 16:36 [Bug c++/12265] New: Downcast to class which derives privately rejected olau at hardworking dot dk
2003-09-12 17:14 ` [Bug c++/12265] " nathan at gcc dot gnu dot org
2003-09-13 16:51 ` olau at hardworking dot dk
2005-09-13 14:09 ` 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).