This is the mail archive of the egcs@egcs.cygnus.com mailing list for the EGCS project. See the EGCS home page for more information.
On Feb 23, 1999, David Mazieres <dm@reeducation-labor.lcs.mit.edu> wrote:
> 5.2.7.8 says of the run-time check done by dynamic_cast:
[snip]
> Thus, the output I would expect would be:
> bp is NULL
> bbp is NULL
> bigger:: bp is NULL
> bigger:: bbp is NULL
> Since all compilers do seem to give special dynamic_casts powers to
> friends and methods, and doing so must require additional
> implementation work in the compiler, I'm willing to believe this is in
> fact correct behavior.
I don't think so. Even if you remove the `friend' declarations, the
result is still wrong. The bug is that dynamic_cast fails to check
whether the source type is a public base class of the target type, as
required in the Standard.
--
Alexandre Oliva http://www.dcc.unicamp.br/~oliva aoliva@{acm.org}
oliva@{dcc.unicamp.br,gnu.org,egcs.cygnus.com,samba.org}
Universidade Estadual de Campinas, SP, Brasil