[clang-tools-extra] [clang-tidy] fix cppcoreguidelines-narrowing-conversions false positives when narrowing integer to signed integer in C++20 (PR #116591)
Julian Schmidt via cfe-commits
cfe-commits at lists.llvm.org
Sat Nov 30 02:33:00 PST 2024
5chmidti wrote:
> 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.
+1
> 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.
> people can choose if they want to relax the rule or not.
> Maybe we should move this check to bugprone and use some configuration to fulfill guideline in cppcoreguidelines parts.
The cppcoreguideline check should implement what the guidelines say, but giving the user choice is a plus. There is no need to move the check to bugprone, because this check is already an alias from the cppcoreguidelines to bugprone. So instead, we could configure the alias in bugprone differently? Right now it is an unconfigured alias.
https://github.com/llvm/llvm-project/pull/116591
More information about the cfe-commits
mailing list