[clang-tools-extra] [clang-tidy] fix cppcoreguidelines-narrowing-conversions false positives when narrowing integer to signed integer in C++20 (PR #116591)
Congcong Cai via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 2 06:20:21 PST 2024
HerrCai0907 wrote:
Actually cppcodingguideline require `gsl` support, which mean the most of fixture in this check is still wrong. I see lots of people in project just use explicit cast instead of implicit cast to avoid this check. But it is totally wrong and mean nothing. Because in c++ standard, [conv.integral], [conv.double] are designed for all kinds of cast.
Here is an example about target related behavior about float to unsigned. Even I use static_cast, bug still exists.
https://godbolt.org/z/eTG1hfod8
https://github.com/llvm/llvm-project/pull/116591
More information about the cfe-commits
mailing list