c++/9221: Incorrect dynamic cast failure
bangerth@dealii.org
bangerth@dealii.org
Tue Jan 7 22:02:00 GMT 2003
Synopsis: Incorrect dynamic cast failure
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Tue Jan 7 14:02:10 2003
State-Changed-Why:
I can confirm this problem, although probably not in the
manner you would like: the fact that the program compiled at
all with 3.2 was the bug -- you use covariant return types
for the clone function. gcc3.2 did not support this, but
accepted the code nevertheless. It works as expected
when you change the line
D* clone () const ...
into
B2* clone () const ...
With the original code, you get with gcc3.2.2pre and
3.3 CVS versions the following message:
x.cc:15: sorry, unimplemented: adjusting pointers for covariant returns
Nathan has implemented covariant return types recently for
the 3.4 mainline (for which I can confirm that the program
works as expected), so this will be available in the
overnext version.
Regards
Wolfgang
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=9221
More information about the Gcc-prs
mailing list