Skip to content

Commit

Permalink
Fix unreachable code warning when signbit returns bool
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbell10 authored and vitaut committed Jan 21, 2018
1 parent 1760c31 commit f78c3e4
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,7 @@ class numeric_limits<fmt::internal::DummyInt> :
using namespace fmt::internal;
// The resolution "priority" is:
// isinf macro > std::isinf > ::isinf > fmt::internal::isinf
if (const_check(sizeof(isinf(x)) == sizeof(bool) ||
sizeof(isinf(x)) == sizeof(int))) {
if (const_check(sizeof(isinf(x)) != sizeof(fmt::internal::DummyInt))) {
return isinf(x) != 0;
}
return !_finite(static_cast<double>(x));
Expand All @@ -467,8 +466,7 @@ class numeric_limits<fmt::internal::DummyInt> :
template <typename T>
static bool isnotanumber(T x) {
using namespace fmt::internal;
if (const_check(sizeof(isnan(x)) == sizeof(bool) ||
sizeof(isnan(x)) == sizeof(int))) {
if (const_check(sizeof(isnan(x)) != sizeof(fmt::internal::DummyInt))) {
return isnan(x) != 0;
}
return _isnan(static_cast<double>(x)) != 0;
Expand All @@ -477,8 +475,7 @@ class numeric_limits<fmt::internal::DummyInt> :
// Portable version of signbit.
static bool isnegative(double x) {
using namespace fmt::internal;
if (const_check(sizeof(signbit(x)) == sizeof(bool) ||
sizeof(signbit(x)) == sizeof(int))) {
if (const_check(sizeof(signbit(x)) != sizeof(fmt::internal::DummyInt))) {
return signbit(x) != 0;
}
if (x < 0) return true;
Expand Down

0 comments on commit f78c3e4

Please sign in to comment.