protected and private inheritance interferes with proper operation of dynamic_cast
Nathan Sidwell
nathan@acm.org
Tue Nov 30 23:39:00 GMT 1999
Darin Adler wrote:
>
> The following test program fails with gcc.
Thanks for the report.
>
> The version I used was gcc version 2.95.2 19991024 (release).
> The system I tested on was a Pentium III PC, running Linux (Red Hat 6.1).
>
> The test should write "test succeeded", but instead writes "test failed".
> Somehow, the fact that MoreDerived inherits from Derived using protected
> inheritance rather than public inheritance results in a failure of the
> dynamic cast on the object from Base* to Derived*, when the object type is
> MoreDerived.
>
> This same test program works fine with some other compilers that I've tried.
It also works with the current CVS version :-) Therefore the next post 2.95
release should also have it. It won't be fixed in a 2.95 release.
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
Never hand someone a gun unless you are sure where they will point it
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
More information about the Gcc-bugs
mailing list