diff --git a/include/fmt/std.h b/include/fmt/std.h index c8b042a4..f1d1d120 100644 --- a/include/fmt/std.h +++ b/include/fmt/std.h @@ -101,14 +101,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 b9c15e02..77cf7934 100644 --- a/test/std-test.cc +++ b/test/std-test.cc @@ -75,6 +75,9 @@ 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 }