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

--- Comment #5 from Mital Ashok <mital at mitalashok dot co.uk> ---
PR94264 prevented the first version from being an issue in GCC13, but the
second version

    struct X { int x[2]; };
    void f() {
      delete X{}.x;
    }

still crashed in older GCC versions. This isn't technically invalid code since
`f()` should just be like `std::unreachable()`. Or it also crashes when it
appears in `if (false) delete X{}.x;` or `false ? delete X{}.x : (void) 0;`

A "valid" array delete (like `delete[]
*__builtin_launder(reinterpret_cast<int(*)[2]>(new int[2]))`) doesn't involve
an array temporary (since the array must have been `new`d), so this does seem
to only happen in code that can't be executed.

Reply via email to