diff --git a/include/fmt/ranges.h b/include/fmt/ranges.h index 6110fdaf..a789a975 100644 --- a/include/fmt/ranges.h +++ b/include/fmt/ranges.h @@ -13,6 +13,7 @@ #define FMT_RANGES_H_ #include + #include "format.h" // output only up to N items from the range. @@ -104,10 +105,7 @@ struct is_range_< /// tuple_size and tuple_element check. template class is_tuple_like_ { template - static auto check(U* p) - -> decltype(std::tuple_size::value, - (void)std::declval::type>(), - int()); + static auto check(U* p) -> decltype(std::tuple_size::value, int()); template static void check(...); public: diff --git a/test/ranges-test.cc b/test/ranges-test.cc index 265f9acd..ee6c4551 100644 --- a/test/ranges-test.cc +++ b/test/ranges-test.cc @@ -10,6 +10,7 @@ // {fmt} support for ranges, containers and types tuple interface. #include "fmt/ranges.h" + #include "gtest.h" // Check if 'if constexpr' is supported. @@ -44,9 +45,10 @@ TEST(RangesTest, FormatPair) { } TEST(RangesTest, FormatTuple) { - std::tuple tu1{42, 1.5f, "this is tuple", - 'i'}; - EXPECT_EQ("(42, 1.5, \"this is tuple\", 'i')", fmt::format("{}", tu1)); + std::tuple t{42, 1.5f, "this is tuple", + 'i'}; + EXPECT_EQ("(42, 1.5, \"this is tuple\", 'i')", fmt::format("{}", t)); + EXPECT_EQ("()", fmt::format("{}", std::tuple<>())); } TEST(RangesTest, JoinTuple) {