[libcxx-commits] [libcxx] [libc++][test] Fix more MSVC and Clang warnings (PR #74965)

Stephan T. Lavavej via libcxx-commits libcxx-commits at lists.llvm.org
Sun Dec 10 03:16:47 PST 2023


================
@@ -60,6 +60,9 @@ constexpr char pattern = 0xDE;
 
 void* operator new(std::size_t count) {
   void* ptr = std::malloc(count);
+  if (!ptr) {
+    std::abort(); // placate MSVC's unchecked malloc warning
----------------
StephanTLavavej wrote:

Unfortunately, static analysis doesn't consider `assert`'s effect on control flow. I'm not sure if this is a compiler bug or by design (because `assert` is controlled by `NDEBUG`). That's why the codebase currently uses `if-abort`.

https://github.com/llvm/llvm-project/pull/74965


More information about the libcxx-commits mailing list