This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/12277] Warn on dynamic casts with known NULL results.
- From: "gcc at dixie dot net.nz" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 27 Nov 2014 21:21:46 +0000
- Subject: [Bug c++/12277] Warn on dynamic casts with known NULL results.
- Auto-submitted: auto-generated
- References: <bug-12277-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=12277
Andrew Dixie <gcc at dixie dot net.nz> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |gcc at dixie dot net.nz
--- Comment #7 from Andrew Dixie <gcc at dixie dot net.nz> ---
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;
}