This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/12277] Warn on dynamic casts with known NULL results.


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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]