LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 49498 - cppcoreguidelines-narrowing-conversions false positive (narrowing conversion from constant 'double' to 'double')
Summary: cppcoreguidelines-narrowing-conversions false positive (narrowing conversion ...
Status: NEW
Alias: None
Product: clang-tools-extra
Classification: Unclassified
Component: clang-tidy (show other bugs)
Version: unspecified
Hardware: PC All
: P normal
Assignee: Nathan James
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-03-09 13:19 PST by Igor Nazarenko
Modified: 2021-03-11 07:09 PST (History)
6 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Igor Nazarenko 2021-03-09 13:19:00 PST
Tested with 12.0.0 and 13.0.0.

In the following program:

-------
#include <limits>

double f(bool t) {
  double b = 1.0;
  constexpr double a = std::numeric_limits<double>::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;
                 ^
Comment 1 Nathan James 2021-03-11 07:09:48 PST
https://reviews.llvm.org/D98416