[cfe-dev] Compiler optimizing out calls to new()

John McCall via cfe-dev cfe-dev at lists.llvm.org
Mon Dec 3 21:02:33 PST 2018


On 3 Dec 2018, at 21:51, Richard Smith via cfe-dev wrote:
> More generally, a (non-placement) new-expression is not required to call
> any 'operator new' in particular to get its storage.

To be precise, this rule applies to new-expressions that directly use one
of the "replaceable global allocation functions", which both includes some
placement forms (e.g. `new (std::nothrow) double[10]`) and excludes some
non-placement forms (e.g. `new MyClass` where `MyClass` declares an
`operator new`).

John.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20181204/1a2925ae/attachment.html>


More information about the cfe-dev mailing list