llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.02k stars 11.96k forks source link

misc-incorrect-roundings does not catch incorrect rounding within the Conditional Operator #40399

Open llvmbot opened 5 years ago

llvmbot commented 5 years ago
Bugzilla Link 41054
Version 6.0
OS Linux
Reporter LLVM Bugzilla Contributor
CC @devincoughlin

Extended Description

I run the checker misc-incorrect-roundings on this piece of code:

return (int) (x < 0 ? x - 0.5 : x + 0.5);

In this case Clang tidy does not pick up on the “x + 0.5” as being an incorrect rounding, which it is.

llvmbot commented 5 years ago

assigned to @devincoughlin