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

Cyp <cyp561 at gmail dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |cyp561 at gmail dot com

--- Comment #3 from Cyp <cyp561 at gmail dot com> ---
I think `p->call(…)` is undefined behaviour when `p` is null, since performing
the call itself counts as dereferencing a null pointer, regardless of whether
`this` is used anywhere in the method.

I think a very old version of Qt might have relied on `this` being able to be
null.

So minimal "testcase" would be:
```c++
struct A {
  void foo() {}
};

int main() {
  static_cast<A *>(nullptr)->foo();  // undefined behaviour, anything can
happen here
}

Reply via email to