diff --git a/include/fmt/format.h b/include/fmt/format.h index 7eac976d..0d577795 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -2658,7 +2658,8 @@ void basic_writer::write_double(T value, const format_specs &spec) { } auto write_inf_or_nan = [this, &spec, sign](const char *str) { - write_padded(INF_SIZE + (sign ? 1 : 0), spec, inf_or_nan_writer{sign, str}); + this->write_padded(INF_SIZE + (sign ? 1 : 0), spec, + inf_or_nan_writer{sign, str}); }; // Format NaN and ininity ourselves because sprintf's output is not consistent diff --git a/include/fmt/ostream.h b/include/fmt/ostream.h index 16d490b2..e28170d4 100644 --- a/include/fmt/ostream.h +++ b/include/fmt/ostream.h @@ -67,8 +67,10 @@ class convert_to_int { template static std::false_type test(...); + typedef decltype(test(0)) result; + public: - static const bool value = !decltype(test(0))::value; + static const bool value = !result::value; }; // Write the content of buf to os. diff --git a/include/fmt/printf.h b/include/fmt/printf.h index 531f6864..9720d972 100644 --- a/include/fmt/printf.h +++ b/include/fmt/printf.h @@ -290,7 +290,7 @@ class printf_arg_formatter : public internal::arg_formatter_base { template struct printf_formatter { template - auto parse(ParseContext &ctx) { return ctx.begin(); } + auto parse(ParseContext &ctx) -> decltype(ctx.begin()) { return ctx.begin(); } template auto format(const T &value, FormatContext &ctx) -> decltype(ctx.begin()) { diff --git a/test/format-test.cc b/test/format-test.cc index f3a961f2..924c6aff 100644 --- a/test/format-test.cc +++ b/test/format-test.cc @@ -137,6 +137,8 @@ TEST(StringViewTest, Ctor) { EXPECT_EQ(4u, string_view(std::string("defg")).size()); } +// GCC 4.6 doesn't have std::is_copy_*. +#if FMT_GCC_VERSION && FMT_GCC_VERSION >= 407 TEST(WriterTest, NotCopyConstructible) { EXPECT_FALSE(std::is_copy_constructible::value); } @@ -144,6 +146,7 @@ TEST(WriterTest, NotCopyConstructible) { TEST(WriterTest, NotCopyAssignable) { EXPECT_FALSE(std::is_copy_assignable::value); } +#endif TEST(WriterTest, Data) { memory_buffer buf;