diff --git a/include/fmt/core.h b/include/fmt/core.h index 738766b7..89cbbb12 100644 --- a/include/fmt/core.h +++ b/include/fmt/core.h @@ -923,7 +923,7 @@ template struct arg_mapper { // A type constant after applying arg_mapper. template using mapped_type_constant = - type_constant().map(std::declval())), + type_constant().map(std::declval())), typename Context::char_type>; enum { packed_arg_bits = 5 }; diff --git a/test/core-test.cc b/test/core-test.cc index c3706002..dac40a0f 100644 --- a/test/core-test.cc +++ b/test/core-test.cc @@ -649,3 +649,14 @@ TEST(FormatterTest, FormatExplicitlyConvertibleToStringLike) { EXPECT_EQ("foo", fmt::format("{}", explicitly_convertible_to_string_like())); } #endif + +struct disabled_rvalue_conversion { + operator const char*() const& { return "foo"; } + operator const char*()& { return "foo"; } + operator const char*() const&& = delete; + operator const char*()&& = delete; +}; + +TEST(FormatterTest, DisabledRValueConversion) { + EXPECT_EQ("foo", fmt::format("{}", disabled_rvalue_conversion())); +}