Fix MSVC build, take 2.

This commit is contained in:
Victor Zverovich 2014-06-24 10:46:01 -07:00
parent 73fda2a8b1
commit 302b8f4406
3 changed files with 5 additions and 2 deletions

View File

@ -118,6 +118,8 @@ void ReportError(FormatFunc func,
}
} // namespace
int fmt::internal::SignBitNoInline(double value) { return SignBit(value); }
template <typename T>
int fmt::internal::CharTraits<char>::FormatFloat(
char *buffer, std::size_t size, const char *format,

View File

@ -399,6 +399,8 @@ inline bool IsNegative(T value) {
return SignChecker<std::numeric_limits<T>::is_signed>::IsNegative(value);
}
int SignBitNoInline(double value);
template <typename T>
struct IntTraits {
// Smallest of uint32_t and uint64_t that is large enough to represent

View File

@ -1235,8 +1235,7 @@ TEST(FormatterTest, FormatNaN) {
double nan = std::numeric_limits<double>::quiet_NaN();
EXPECT_EQ("nan", str(Format("{}") << nan));
EXPECT_EQ("+nan", str(Format("{:+}") << nan));
using namespace std;
if (signbit(-nan))
if (fmt::internal::SignBitNoInline(-nan))
EXPECT_EQ("-nan", str(Format("{}") << -nan));
else
fmt::Print("Warning: compiler doesn't handle negative NaN correctly");