diff --git a/include/fmt/std.h b/include/fmt/std.h index 41d2b2838b6d..2511d5390ec6 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -100,14 +100,12 @@ template using variant_index_sequence = std::make_index_sequence::value>; -// variant_size and variant_alternative check. -template +template struct is_variant_like_ : std::false_type {}; -template -struct is_variant_like_::value)>> - : std::true_type {}; +template +struct is_variant_like_> : std::true_type {}; -// formattable element check +// formattable element check. template class is_variant_formattable_ { template static std::conjunction< diff --git a/test/std-test.cc b/test/std-test.cc index c22b3e38fb39..76de163b82e7 100644 --- a/test/std-test.cc +++ b/test/std-test.cc @@ -75,5 +75,8 @@ TEST(std_test, variant) { EXPECT_EQ(fmt::format("{}", v4), "variant(monostate)"); EXPECT_EQ(fmt::format("{}", v5), "variant(\"yes, this is variant\")"); + + volatile int i = 42; // Test compile error before GCC 11 described in #3068. + EXPECT_EQ(fmt::format("{}", i), "42"); #endif }