From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16239 invoked by alias); 7 Jan 2003 22:02:10 -0000 Mailing-List: contact gcc-prs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-prs-owner@gcc.gnu.org Received: (qmail 16219 invoked by uid 61); 7 Jan 2003 22:02:10 -0000 Date: Tue, 07 Jan 2003 22:02:00 -0000 Message-ID: <20030107220210.16218.qmail@sources.redhat.com> To: gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, paterno@fnal.gov, wb@fnal.gov From: bangerth@dealii.org Reply-To: bangerth@dealii.org, gcc-bugs@gcc.gnu.org, gcc-prs@gcc.gnu.org, nobody@gcc.gnu.org, paterno@fnal.gov, wb@fnal.gov, gcc-gnats@gcc.gnu.org Subject: Re: c++/9221: Incorrect dynamic cast failure X-SW-Source: 2003-01/txt/msg00473.txt.bz2 List-Id: 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