[clang-tools-extra] [clang-tidy] Rename `cert-mem57-cpp` to `bugprone-default-operator-new-on-overaligned-type` (PR #165542)

via cfe-commits cfe-commits at lists.llvm.org
Sat Nov 1 09:00:58 PDT 2025


================
@@ -0,0 +1,12 @@
+// RUN: %check_clang_tidy %s -std=c++14 bugprone-default-operator-new-on-overaligned-type %t
----------------
zeyi2 wrote:

I did some furthur investigating, I think this check explicitly disables itself for C++17 or later:

In `DefaultOperatorNewOnOveralignedTypeCheck.h` at [L26](https://github.com/zeyi2/llvm-project/blob/7cb6b293ef9169b7dbd9968624ff5090e5ff8b3e/clang-tools-extra/clang-tidy/bugprone/DefaultOperatorNewOnOveralignedTypeCheck.h#L26), `DefaultOperatorNewOnOveralignedTypeCheck::isLanguageVersionSupported` returns `!LangOpts.CPlusPlus17`

I think the reason is because from C++17 onward, Clang [enables aligned allocation](https://github.com/llvm/llvm-project/blob/main/clang/include/clang/Driver/Options.td#L3696)  by default. So this tidy check becomes redundant and is disabled.

Should we remove this test file?

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


More information about the cfe-commits mailing list