From 866d222d6065822ac40c74edbd456c7f0367b65b Mon Sep 17 00:00:00 2001 From: Gael Guennebaud Date: Tue, 3 Apr 2018 17:15:38 +0200 Subject: [PATCH] commit 45e9c9996da790b55ed9c4b0dfeae49492ac5c46 (HEAD -> memory_fix) Author: George Burgess IV Date: Thu Mar 1 11:20:24 2018 -0800 Prefer `::operator new` to `new` The C++ standard allows compilers much flexibility with `new` expressions, including eliding them entirely (https://godbolt.org/g/yS6i91). However, calls to `operator new` are required to be treated like opaque function calls. Since we're calling `new` for side-effects other than allocating heap memory, we should prefer the less flexible version. Signed-off-by: George Burgess IV (grafted from 8c7b5158a10af19bb98f2c2b5c57d44fd8899fe8 ) --- Eigen/src/Core/util/Memory.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 2ab8ffaee..66cdbd8dd 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -70,7 +70,7 @@ inline void throw_std_bad_alloc() throw std::bad_alloc(); #else std::size_t huge = static_cast(-1); - new int[huge]; + ::operator new(huge); #endif }