https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105789
Bug ID: 105789 Summary: The instance of a deallocation function template is never a usual deallocation function Product: gcc Version: 13.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: xmh970252187 at gmail dot com Target Milestone: --- struct S { // Placement allocation function: static void* operator new(std::size_t, std::size_t); // Usual (non-placement) deallocation function: it's not true template<class T> static void operator delete(void*, T); }; int main(){ S* p = new (0) S; } GCC rejects this example and reported the instance of the deallocation function template is a usual one, as pointed out by the comment. However, [basic.stc.dynamic.deallocation] p3 says: > A template instance is never a usual deallocation function, regardless of its > signature. That means the instance of the deallocation function template is a placement one, which matches the placement allocation function so that this example didn't violate [expr.new] p28. GCC ought to accept this well-formed example.