public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
[parent not found: <bug-12277-3548@http.gcc.gnu.org/bugzilla/>]
* [Bug c++/12277] New: Warn on dynamic casts with known NULL results.
@ 2003-09-14 16:55 tilps at hotmail dot com
  2003-09-14 17:23 ` [Bug c++/12277] " pinskia at gcc dot gnu dot org
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: tilps at hotmail dot com @ 2003-09-14 16:55 UTC (permalink / raw)
  To: gcc-bugs

PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12277

           Summary: Warn on dynamic casts with known NULL results.
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: tilps at hotmail dot com
                CC: gcc-bugs at gcc dot gnu dot org

While this can not be done generally - if the inheritence relation between the
type being cast from and the type being cast to is known at the time of use,
there are some cases where a dynamic cast can be sure to return NULL.  I can not
think of any valid use of a dynamic cast which will always return NULL - so
therefore I suggest that a warning be given.
The specific case which bothered me (and hence why i'm writing this) is
upcasting through private inheritence always gives NULL for dynamic cast.


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2021-10-01 10:22 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-12277-4@http.gcc.gnu.org/bugzilla/>
2013-11-07 10:26 ` [Bug c++/12277] Warn on dynamic casts with known NULL results paolo.carlini at oracle dot com
2014-11-27 21:21 ` gcc at dixie dot net.nz
2014-11-27 21:23 ` gcc at dixie dot net.nz
2014-11-28  8:44 ` ville.voutilainen at gmail dot com
2021-02-11 23:28 ` [Bug c++/12277] eliminate and warn " msebor at gcc dot gnu.org
2021-10-01 10:22 ` egallager at gcc dot gnu.org
     [not found] <bug-12277-3548@http.gcc.gnu.org/bugzilla/>
2005-11-26  8:05 ` [Bug c++/12277] Warn " gdr at gcc dot gnu dot org
2007-06-11 11:19 ` pinskia at gcc dot gnu dot org
2009-07-06 20:45 ` jason at gcc dot gnu dot org
2009-07-06 20:56 ` bangerth at gmail dot com
2003-09-14 16:55 [Bug c++/12277] New: " tilps at hotmail dot com
2003-09-14 17:23 ` [Bug c++/12277] " pinskia at gcc dot gnu dot org
2003-09-15  0:42 ` bangerth at dealii dot org
2004-05-20 12:12 ` pinskia at gcc dot gnu dot org
2004-05-20 13:25 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).