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

            Bug ID: 70295
           Summary: [6 Regression] bogus -Wnonnull-compare for
                    "dynamic_cast<const FuSelection *>(this) != nullptr"
           Product: gcc
           Version: 6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: trippels at gcc dot gnu.org
  Target Milestone: ---

trippels@CFARM-IUT-TLSE3 ~ % cat fudraw.ii
enum SdrHitKind {};
class FuSelection {
  void m_fn1(void *);
};
void FuSelection::m_fn1(void *) {
  SdrHitKind eHit;
  if (eHit && dynamic_cast<const FuSelection *>(this) != nullptr)
    ;
}
trippels@CFARM-IUT-TLSE3 ~ % g++ -c -O2 -Wnonnull-compare fudraw.ii 
fudraw.ii: In member function ‘void FuSelection::m_fn1(void*)’:
fudraw.ii:7:55: warning: nonnull argument ‘this’ compared to NULL
[-Wnonnull-compare]
   if (eHit && dynamic_cast<const FuSelection *>(this) != nullptr)
               ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~

Reply via email to