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

--- Comment #20 from Martin Sebor <msebor at gcc dot gnu.org> ---
Martin, does the code in the packages follow the pattern below?

$ cat t.C && gcc -O2 -S -Wall t.C
struct A { virtual ~A (); };
struct B { virtual ~B (); void f (); };

void f (A *p)
{
  if (dynamic_cast<B*>(p))
    dynamic_cast<B*>(p)->f ();
}
t.C: In function ‘void f(A*)’:
t.C:7:29: warning: ‘this’ pointer is null [-Wnonnull]
    7 |     dynamic_cast<B*>(p)->f ();
      |                             ^
t.C:2:32: note: in a call to non-static member function ‘void B::f()’
    2 | struct B { virtual ~B (); void f (); };
      |                                ^

Reply via email to