This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of New status.
operator delete should be constexprSection: 17.6.3.4 [new.delete.placement] Status: New Submitter: Jakub Jelinek Opened: 2025-11-18 Last modified: 2025-11-18
Priority: Not Prioritized
View other active issues in [new.delete.placement].
View all other issues in [new.delete.placement].
View all issues with New status.
Discussion:
The P2747R2 paper made placement operator new constexpr. At that time constexpr exceptions weren't in C++26, so that was all that was needed. But later on when P3068R5 was voted in, the P2747R2 changes look insufficient. The problem is that when you throw from a constructor during operator new, it invokes placement operator delete. And P2747R2 didn't touch that.
This makes it impossible to handle an exception thrown by a placement new-expression during constant evaluation.
Proposed resolution:
This wording is relative to N5014.
Modify 17.6.2 [new.syn] as indicated:
constexpr void* operator new (std::size_t size, void* ptr) noexcept; constexpr void* operator new[](std::size_t size, void* ptr) noexcept; constexpr void operator delete (void* ptr, void*) noexcept; constexpr void operator delete[](void* ptr, void*) noexcept;
Modify 17.6.3.4 [new.delete.placement] as indicated:
constexpr void* operator new(std::size_t size, void* ptr) noexcept;[…]
constexpr void* operator new[](std::size_t size, void* ptr) noexcept;[…]
constexpr void operator delete(void* ptr, void*) noexcept;-7- Effects: Intentionally performs no action.
-8- Remarks: Default function called when any part of the initialization in a placement new-expression that invokes the library's non-array placement operator new terminates by throwing an exception (7.6.2.8 [expr.new]).
constexpr void operator delete[](void* ptr, void*) noexcept;-9- Effects: Intentionally performs no action.
-10- Remarks: Default function called when any part of the initialization in a placement new-expression that invokes the library's array placement operator new terminates by throwing an exception (7.6.2.8 [expr.new]).