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++/15541] New: No warning if static checking can tell that a dynamic_cast will fail


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


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