But std::allocator is not freestanding. How am I supposed to allocate heap memory in constexpr in freestanding? ________________________________ From: Jonathan Wakely <jwakely.gcc@xxxxxxxxx> Sent: Tuesday, August 13, 2024 16:16 To: pifminns deettnta <tstndeemkssz@xxxxxxxxxxx> Cc: gcc-help@xxxxxxx <gcc-help@xxxxxxx>; jakub@xxxxxxxxxxx <jakub@xxxxxxxxxxx> Subject: Re: constexpr operator new? On Mon, 12 Aug 2024, 23:52 pifminns deettnta via Gcc-help, <gcc-help@xxxxxxxxxxx<mailto:gcc-help@xxxxxxxxxxx>> wrote: I have just found you implemented constexpr placement new https://github.com/gcc-mirror/gcc/commit/afa3a4a52cf91485477e4aaa5f05987ec7ff869d https://godbolt.org/z/h7WETe5M3 Hi Jakub. I try to allocate memory with operator in constexpr context but it does not seem the C++ standard allows it. However, std::allocator is not freestanding based on C++ standard. Is that a standard defect? I think void* operator new ( std::size_t<http://en.cppreference.com/w/cpp/types/size_t> count ); and void operator delete ( void* ptr ) noexcept; should also be constexpr to allow custom allocators to work in constexpr context. If it is a defect, could you report it to wg21? Thank you This is the approved design, so not a defect.