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

            Bug ID: 69850
           Summary: [6 Regression] unnecessary -Wnonnull-compare warning
           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@gcc2-power8 status % cat cmp_set.ii
class shared_count {
public:
  ~shared_count() { delete this; }
};
class A {
  shared_count pn;
};
class B {
public:
  B(bool);
  A m_message;
};
void fn1(B) { fn1(0); }

trippels@gcc2-power8 status % g++ -Wall -O2 -c cmp_set.ii
cmp_set.ii: In destructor ‘shared_count::~shared_count()’:
cmp_set.ii:3:32: warning: nonnull argument ‘this’ compared to NULL
[-Wnonnull-compare]
   ~shared_count() { delete this; }
                                ^

Reply via email to