https://bugs.llvm.org/show_bug.cgi?id=36476

Richard Smith <richard-l...@metafoo.co.uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |INVALID
             Status|NEW                         |RESOLVED
                 CC|                            |richard-l...@metafoo.co.uk

--- Comment #1 from Richard Smith <richard-l...@metafoo.co.uk> ---
C++ [expr.new]p10 (http://eel.is/c++draft/expr.new#10) explicitly permits this
optimization:

"An implementation is allowed to omit a call to a replaceable global allocation
function ([new.delete.single], [new.delete.array]). When it does so, the
storage is instead provided by the implementation"

If you want to observe side-effects of your '::operator new(size_t)'
implementation (eg, when writing tests for your allocator), you need to make a
regular function call, rather than using a new-expression. LLVM will not delete
the 'operator new' call here:

    S *s = new (::operator new(sizeof(S))) S;

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to