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: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 May 2004 13:32:00 -0000
- Subject: [Bug c++/12277] Warn on dynamic casts with known NULL results.
- References: <20030914164017.12277.tilps@hotmail.com>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Additional Comments From pinskia at gcc dot gnu dot org 2004-05-19 13:31 -------
And here is an example:
struct Base
{
virtual ~Base () {}
};
class Derived : Base
{
friend int main ();
};
#include <cassert>
int main ()
{
Base * p = new Derived;
assert(dynamic_cast<Derived *>(p)); // fails
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12277