public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "filip.roseen at gmail dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/60262] New: explicit destructor call to destructor of Base accepted without using a qualified-id Date: Tue, 18 Feb 2014 11:59:00 -0000 [thread overview] Message-ID: <bug-60262-4@http.gcc.gnu.org/bugzilla/> (raw) http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60262 Bug ID: 60262 Summary: explicit destructor call to destructor of Base accepted without using a qualified-id Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: filip.roseen at gmail dot com Created attachment 32160 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=32160&action=edit testcase.cpp struct Base { }; struct Derived : Base { }; int main () { Derived * ptr = new Derived; ptr->~Base (); // illegal // ... } -------------------------------------------------------------------------------- gcc (incorrectly) accepts the above, while clang and icc (among others) correctly issues a diagnostic saying that the statement marked `// illegal` is illformed. Destructors are not inherited and with this the destructor of `Base` is not found via `ptr->~Base`, as can be read about under [class.virtual]p6: "Even though destructors are not inherited, <snip />" This is not to be confused with a qualified explicit destructor call such as `ptr->Base::~Base ()`, this is correctly accepted and is legal according to several sections in the standard, including [class.dtor]p13.
next reply other threads:[~2014-02-18 11:59 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2014-02-18 11:59 filip.roseen at gmail dot com [this message] 2014-08-22 3:01 ` [Bug c++/60262] explicit destructor call via Derived " potswa at mac dot com 2014-12-14 0:09 ` ville.voutilainen at gmail dot com
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=bug-60262-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /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).