This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12265] Downcast to class which derives privately rejected
- From: "nathan at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 12 Sep 2003 16:46:27 -0000
- Subject: [Bug c++/12265] Downcast to class which derives privately rejected
- References: <20030912163500.12265.olau@hardworking.dk>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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.