[clang] [analyzer] Fix FP for cplusplus.placement new #149240 (PR #150161)
DonĂ¡t Nagy via cfe-commits
cfe-commits at lists.llvm.org
Wed Jul 23 00:43:08 PDT 2025
https://github.com/NagyDonat commented:
The code that you're removing is not an accidental bug, but an intentional (although perhaps overzealous) feature that tries to warn about the fact that placement new for an array type may allocate an unspecified amount of overhead (extra memory) for internal needs.
According to a quick search this was a significant issue especially in Visual Studio (where it could cause memory corruption), but very recent versions of the standard (C++20 and later) declare that _placement_ new of arrays must not introduce an overhead: https://stackoverflow.com/a/75418614
To improve the usefulness of this checker, I weakly support this change, but I would also like to see a second opinion from @steakhal @Xazax-hun @haoNoQ or other contributors.
https://github.com/llvm/llvm-project/pull/150161
More information about the cfe-commits
mailing list