public inbox for gcc-prs@sourceware.org help / color / mirror / Atom feed
From: paterno@fnal.gov To: gcc-gnats@gcc.gnu.org Cc: wb@fnal.gov Subject: c++/9221: Incorrect dynamic cast failure Date: Tue, 07 Jan 2003 21:46:00 -0000 [thread overview] Message-ID: <20030107213622.26016.qmail@sources.redhat.com> (raw) >Number: 9221 >Category: c++ >Synopsis: Incorrect dynamic cast failure >Confidential: no >Severity: serious >Priority: medium >Responsible: unassigned >State: open >Class: sw-bug >Submitter-Id: net >Arrival-Date: Tue Jan 07 13:46:01 PST 2003 >Closed-Date: >Last-Modified: >Originator: paterno@fnal.gov >Release: gcc (GCC) 3.2 20020927 (prerelease) >Organization: >Environment: Cygwin 1.3.18-1, on Windows 2000. >Description: // The following code compiles with g++ -O0 dcast.cpp. // The second assertion incorrectly fails. #include <assert.h> struct B1 { virtual ~B1() {} }; struct B2 { virtual ~B2() {} virtual B2* clone() const = 0; }; struct D : public B1, public B2 { D() : B1(), B2() { } D* clone() const { return new D; } }; int main() { D d; B2* p1 = &d; B2* pb = p1->clone(); assert ( pb != 0 ); D* pd = dynamic_cast<D*>(pb); assert ( pd != 0 ); delete pb; } >How-To-Repeat: Compile the source file with 'g++ -O0', or any other optimization level. >Fix: No work-around known. >Release-Note: >Audit-Trail: >Unformatted:
next reply other threads:[~2003-01-07 21:46 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-01-07 21:46 paterno [this message] 2003-01-07 22:02 bangerth
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20030107213622.26016.qmail@sources.redhat.com \ --to=paterno@fnal.gov \ --cc=gcc-gnats@gcc.gnu.org \ --cc=wb@fnal.gov \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).