Skip to content

Commit

Permalink
Fix for issue fmtlib#3068
Browse files Browse the repository at this point in the history
Signed-off-by: Vladislav Shchapov <[email protected]>
  • Loading branch information
phprus committed Sep 1, 2022
1 parent 40e414d commit f526e71
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/fmt/std.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ using variant_index_sequence =
template <typename T, typename U = void>
struct is_variant_like_ : std::false_type {};
template <typename T>
struct is_variant_like_<T, std::void_t<decltype(std::variant_size<T>::value)>>
struct is_variant_like_<
T, std::void_t<decltype(std::variant_size<std::remove_cv_t<T>>::value)>>
: std::true_type {};

// formattable element check
Expand Down
3 changes: 3 additions & 0 deletions test/std-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
EXPECT_EQ(fmt::format("{}", i), "42");
#endif
}

0 comments on commit f526e71

Please sign in to comment.