This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/16147] dynamic_cast fails to enforce accesssibility
- From: "gdr at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Aug 2004 15:17:13 -0000
- Subject: [Bug c++/16147] dynamic_cast fails to enforce accesssibility
- References: <20040622225853.16147.gdr@gcc.gnu.org>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From gdr at gcc dot gnu dot org 2004-08-29 15:17 -------
(In reply to comment #1)
> Just as additional data points:
> gcc2.95 passes the assertion
> gcc3.2.3 through mainline fail it
> icc7.1 and 8 fail it as well.
>
> I may be dense, but I somehow miss why you claim that it should pass. Can
> you elaborate?
5.2.7/8 states:
The run-time check logically executes as follows:
--- If, in the most derived object pointed (referred) to by v, v points
(refers) to a public base class subobject of a T object, and if only one
object of type T is derived from the sub-object pointed (referred) to by
v, the result is a pointer (an lvalue referring) to that T object.
--- Otherwise, if v points (refers) to a public base class sub-object of the
most derived object, and the type of the most derived object has a base
class, of type T, that is unambiguous and public, the result is a
pointer (an lvalue referring) to the T sub-object of the most derived
object.
--- Otherwise, the run-time check fails.
The reason the test should fail is that A is not a public base of the most
derived object (which is of type C).
-- Gaby
--
What |Removed |Added
----------------------------------------------------------------------------
CC| |nathan at codesourcery dot
| |com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=16147