https://gcc.gnu.org/bugzilla/show_bug.cgi?id=129086
Bug ID: 129086
Summary: Deleting pointer to incomplete type with non-trivial
destructor not rejected during constant evaluation
Product: gcc
Version: 17.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: gongke at ios dot ac.cn
Target Milestone: ---
[godbolt](https://godbolt.org/z/To8qdd14e)
```cpp
struct S;
constexpr void del(S* p) { delete p; } // S incomplete at the point of
deletion
struct S { constexpr ~S() {} }; // complete class: user-provided =>
non-trivial dtor
constexpr bool f() { S* p = new S; del(p); return true; }
static_assert(f());
int main() {}
```
Such delete expression is ill-formed since C++26, but it should still be
rejected before C++26 if it is within a constant evaluation since it is an
undefined behavior (with `S` having a non-trivial destructor).