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

Fix unreachable code warning when signbit returns bool #640

Merged
merged 1 commit into from
Jan 21, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions fmt/format.h
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,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 @@ -455,8 +454,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 @@ -465,8 +463,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