public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "ville.voutilainen at gmail dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/12277] Warn on dynamic casts with known NULL results.
Date: Fri, 28 Nov 2014 08:44:00 -0000 [thread overview]
Message-ID: <bug-12277-4-kBj3kVKjlH@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-12277-4@http.gcc.gnu.org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12277
Ville Voutilainen <ville.voutilainen at gmail dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ville.voutilainen at gmail dot com
--- Comment #9 from Ville Voutilainen <ville.voutilainen at gmail dot com> ---
(In reply to Andrew Dixie from comment #7)
> With final, I believe the following dynamic_cast must always return NULL:
>
> struct a1 { virtual ~a1() {} };
> struct a2 final { virtual ~a2() {} };
>
> bool test(a1 *x)
> {
> return dynamic_cast<a2 *>(x) != 0;
> }
If a1 is final, sure. Whether a2 is final is irrelevant.
next prev parent reply other threads:[~2014-11-28 8:44 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <bug-12277-4@http.gcc.gnu.org/bugzilla/>
2013-11-07 10:26 ` paolo.carlini at oracle dot com
2014-11-27 21:21 ` gcc at dixie dot net.nz
2014-11-27 21:23 ` gcc at dixie dot net.nz
2014-11-28 8:44 ` ville.voutilainen at gmail dot com [this message]
2021-02-11 23:28 ` [Bug c++/12277] eliminate and warn " msebor at gcc dot gnu.org
2021-10-01 10:22 ` egallager at gcc dot gnu.org
[not found] <bug-12277-3548@http.gcc.gnu.org/bugzilla/>
2005-11-26 8:05 ` [Bug c++/12277] Warn " gdr at gcc dot gnu dot org
2007-06-11 11:19 ` pinskia at gcc dot gnu dot org
2009-07-06 20:45 ` jason at gcc dot gnu dot org
2009-07-06 20:56 ` bangerth at gmail dot com
2003-09-14 16:55 [Bug c++/12277] New: " tilps at hotmail dot com
2003-09-14 17:23 ` [Bug c++/12277] " pinskia at gcc dot gnu dot org
2003-09-15 0:42 ` bangerth at dealii dot org
2004-05-20 12:12 ` pinskia at gcc dot gnu dot org
2004-05-20 13:25 ` pinskia at gcc dot gnu dot org
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-12277-4-kBj3kVKjlH@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: link
Be 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).