[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
Tue Nov 26 06:12:28 PST 2024


carlosgalvezp wrote:

>  since we have already allow the to unsigned cast later 

I'm not sure I follow, could you point me to an example of this?

When implementing guidelines, we must make sure we implement exactly what the guidelines say, and not make them  less restrictive (at least not by default). The user expectation is that a C++ Core Guideline check will implement just that, not something else. 

I cannot see anything in the C++ Core Guidelines that says narrowing is OK in C++20 (since information is still lost).

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


More information about the cfe-commits mailing list