Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cppcoreguidelines-narrowing-conversions false positive (narrowing conversion from constant 'double' to 'double') #48842

Closed
llvmbot opened this issue Mar 9, 2021 · 2 comments
Labels
bugzilla Issues migrated from bugzilla clang-tidy false-positive Warning fires when it should not

Comments

@llvmbot
Copy link
Member

llvmbot commented Mar 9, 2021

Bugzilla Link 49498
Version unspecified
OS All
Reporter LLVM Bugzilla Contributor
CC @legrosbuffle,@EugeneZelenko

Extended Description

Tested with 12.0.0 and 13.0.0.

In the following program:


#include

double f(bool t) {
double b = 1.0;
constexpr double a = std::numeric_limits::infinity();
return t ? b : a;
}

when invoked as:

clang-tidy --checks='*' test.cc

the following warning is reported:

test.cc:6:18: warning: narrowing conversion from constant 'double' to 'double' [bugprone-narrowing-conversions,cppcoreguidelines-narrowing-conversions]
return t ? b : a;
^

@llvmbot
Copy link
Member Author

llvmbot commented Mar 11, 2021

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 11, 2021
@EugeneZelenko EugeneZelenko added the false-positive Warning fires when it should not label Sep 3, 2022
@carlosgalvezp carlosgalvezp added the awaiting-review Has pending Phabricator review label Apr 6, 2023
@carlosgalvezp
Copy link
Contributor

Fixed in 4530c3b

@github-actions github-actions bot removed the awaiting-review Has pending Phabricator review label Apr 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla clang-tidy false-positive Warning fires when it should not
Projects
None yet
Development

No branches or pull requests

3 participants