https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98646

Martin Sebor <msebor at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
     Ever confirmed|0                           |1
           See Also|                            |https://gcc.gnu.org/bugzill
                   |                            |a/show_bug.cgi?id=96003
             Blocks|                            |95507
             Status|UNCONFIRMED                 |NEW
           Keywords|                            |diagnostic
            Summary|A static_cast confuses      |[11 Regression] A
                   |-Wnonnull, causing false    |static_cast confuses
                   |positives                   |-Wnonnull, causing false
                   |                            |positives
   Last reconfirmed|                            |2021-01-13

--- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> ---
Confirmed.  It must be an instance we missed in the fix for pr96003 where the
C++ front end adds a COND_EXPR to static_cast.

The larger context in the translation unit is:

  if (tp && tp->handle())
    transientXcbParent = static_cast<const QXcbWindow
*>(tp->handle())->winId();

The caller guards against tp->handle() being null but the front end doesn't
consider that and adds another guard which then triggers the warning that also
runs in the front end.  The pr96003 fix works around the same problem by
setting the TREE_NO_WARNING bit so the same hack is needed wherever else the
front end builds a static_cast.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=95507
[Bug 95507] [meta-bug] bogus/missing -Wnonnull

Reply via email to