[PATCH] D127641: [clang-cl][MSVC] Enable /Zc:alignedNew for C++17 and /Zc:sizedDealloc by default

Stephen Long via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 20 14:06:01 PDT 2022


steplong added a comment.

It looks like misc-new-delete-overloads.cpp is failing on line 20:

   1 // RUN: %check_clang_tidy %s misc-new-delete-overloads %t
   2
   3 typedef decltype(sizeof(int)) size_t;
   4
   5 struct S {
   6   // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: declaration of 'operator new' has no matching declaration of 'operator delete' at the same scope [misc-new-delete-overloads]
   7   void *operator new(size_t size) noexcept;
   8   // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: declaration of 'operator new[]' has no matching declaration of 'operator delete[]' at the same scope
   9   void *operator new[](size_t size) noexcept;
  10 };
  11
  12 // CHECK-MESSAGES: :[[@LINE+1]]:7: warning: declaration of 'operator new' has no matching declaration of 'operator delete' at the same scope
  13 void *operator new(size_t size) noexcept(false);
  14
  15 struct T {
  16   // Sized deallocations are not enabled by default, and so this new/delete pair
  17   // does not match. However, we expect only one warning, for the new, because
  18   // the operator delete is a placement delete and we do not warn on mismatching
  19   // placement operations.
  20   // CHECK-MESSAGES: :[[@LINE+1]]:9: warning: declaration of 'operator new' has no matching declaration of 'operator delete' at the same scope
  21   void *operator new(size_t size) noexcept;
  22   void operator delete(void *ptr, size_t) noexcept; // ok only if sized deallocation is enabled
  23 };

On Line 16, it says sized deallocations are not enabled by default, but this patch turns it on by default for MSVC.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127641/new/

https://reviews.llvm.org/D127641



More information about the cfe-commits mailing list