Override the single object version of operator new with std::nothrow_t in ANGLE's pool allocator Flutter builds libcxx with exceptions disabled. Libcxx requires an override of the std::nothrow_t version of operator new if the exception throwing version has been overridden. See https://github.com/flutter/flutter/pull/180072 Change-Id: I5d4ff641d8ee87679acbd38aadf9ce508a0e3f7f
diff --git a/src/common/PoolAlloc.cpp b/src/common/PoolAlloc.cpp index 28e3271..ce887e7 100644 --- a/src/common/PoolAlloc.cpp +++ b/src/common/PoolAlloc.cpp
@@ -28,8 +28,12 @@ # include <sanitizer/asan_interface.h> #endif -// Flutter patch - libcxx requires an override of operator new[](size_t, nothrow_t) -// if operator new[](size_t) has been overridden and exceptions are disabled. +// Flutter patch - libcxx requires overrides of operator new with +// std::nothrow_t if operator new has been overridden and exceptions are +// disabled. +void* operator new(size_t size, const std::nothrow_t&) noexcept { + return ::operator new(size); +} void* operator new[](size_t size, const std::nothrow_t&) noexcept { return ::operator new[](size); }