This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/15541] New: No warning if static checking can tell that a dynamic_cast will fail
- From: "bangerth at dealii dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 19 May 2004 13:16:02 -0000
- Subject: [Bug c++/15541] New: No warning if static checking can tell that a dynamic_cast will fail
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Per conclusion from PR 15531:
In this code, the dynamic_cast will always fail:
-------------------------
struct Base
{
virtual ~Base () {}
};
class Derived : Base
{
friend int main ();
};
#include <cassert>
int main ()
{
Base * p = new Derived;
assert(dynamic_cast<Derived *>(p)); // fails
}
------------
We should issue a warning about this, but don't.
W.
--
Summary: No warning if static checking can tell that a
dynamic_cast will fail
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P2
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: bangerth at dealii dot org
CC: gcc-bugs at gcc dot gnu dot org,gccbugs at contacts dot
eelis dot net,gdr at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15541