summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2015-12-30 14:26:07 +0000
committerAaron Ballman <aaron@aaronballman.com>2015-12-30 14:26:07 +0000
commitdbc441eb34d41e929f4d07b16e030746f25fd344 (patch)
treefc48e3065ad63f27dff1e5c63f2537afbb08bdc0 /clang/lib/Sema
parent666761afabe5c7a36c4b326d537d00c2820644f2 (diff)
downloadbcm5719-llvm-dbc441eb34d41e929f4d07b16e030746f25fd344.tar.gz
bcm5719-llvm-dbc441eb34d41e929f4d07b16e030746f25fd344.zip
When performing an implicit from float to bool, the floating point value must be *exactly* zero in order for the conversion to result in 0. This does not involve a conversion through an integer value, and so truncation of the value is not performed.
This patch address PR25876. llvm-svn: 256643
Diffstat (limited to 'clang/lib/Sema')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 59d51f7e84c..cbdcb5e4839 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -6983,7 +6983,7 @@ void DiagnoseFloatingLiteralImpCast(Sema &S, FloatingLiteral *FL, QualType T,
SmallString<16> PrettyTargetValue;
if (T->isSpecificBuiltinType(BuiltinType::Bool))
- PrettyTargetValue = IntegerValue == 0 ? "false" : "true";
+ PrettyTargetValue = Value.isZero() ? "false" : "true";
else
IntegerValue.toString(PrettyTargetValue);
OpenPOWER on IntegriCloud