[clang-tools-extra] [clang-tidy] fix cppcoreguidelines-narrowing-conversions false positives when narrowing integer to signed integer in C++20 (PR #116591)

Carlos Galvez via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 18 01:52:05 PST 2024


carlosgalvezp wrote:

My understanding of the guidelines is that the purpose of this rule is to avoid data loss (truncation) due to narrowing. In that sense, isn't this still a problem in C++20? 

Whether it well-defined behavior in C++20 or implementation-defined behavior pre-C++20 does not seem relevant to me. We could certainly adjust the warning message to avoid saying it's "implementation-defined" in C++20.

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


More information about the cfe-commits mailing list