https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110661
Bug ID: 110661 Summary: Weird handing for deleting a void* pointer Product: gcc Version: 14.0 Status: UNCONFIRMED Keywords: accepts-invalid Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: de34 at live dot cn Target Milestone: --- GCC accepts the following code snipped and says that " warning: deleting 'void*' is undefined". Godbolt link: https://godbolt.org/z/xKWTGrfPc ``` constexpr int test_delete_pvoid() { delete static_cast<void*>(new int); return 0; } constexpr int n = test_delete_pvoid(); ``` It's contradictory that GCC considers this undefined but accepts it in constant evaluation. Moreover, https://eel.is/c++draft/expr.delete#1 seemingly states that deleting a void* pointer is ill-formed.