[LLVMdev] Memory Allocation Optimized away with new by not with ::operator new

François Fayard fayard.francois at icloud.com
Mon May 4 06:27:20 PDT 2015


Hi,

I have checked and N3664 only talks about new/delete but not about operator
new/delete. Do you know the rationale behind this choice?

> On 04 May 2015, at 13:45, Benjamin Kramer <benny.kra at gmail.com> wrote:
> 
> Sadly this is a feature. The C++ standard has been unclear
> historically about whether removing pairs of new/delete. The problem
> is that the user may override them so this is an observable change,
> but some compilers (LLVM) removed them anyways. As you said C++14
> changed the wording so removing new/delete expression pairs is now
> explicitly legal. Calls to ::operator new and delete aren't new/delete
> expressions though, so it should behave as expected when overridden.
> 
> It looks like a glitch in the standard, but if I remember correctly it
> was done intentionally.
> 
> - Ben

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20150504/53079bd4/attachment.html>


More information about the llvm-dev mailing list