fix udl_compiled_string with non-byte chars (e.g. wchar) (#2242)
This commit is contained in:
parent
c5d4fcb119
commit
1d4199f46b
@ -947,8 +947,9 @@ size_t formatted_size(const CompiledFormat& cf, const Args&... args) {
|
|||||||
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
#if FMT_USE_NONTYPE_TEMPLATE_PARAMETERS
|
||||||
inline namespace literals {
|
inline namespace literals {
|
||||||
template <detail::fixed_string Str>
|
template <detail::fixed_string Str>
|
||||||
constexpr detail::udl_compiled_string<remove_cvref_t<decltype(Str.data[0])>,
|
constexpr detail::udl_compiled_string<
|
||||||
sizeof(Str.data), Str>
|
remove_cvref_t<decltype(Str.data[0])>,
|
||||||
|
sizeof(Str.data) / sizeof(decltype(Str.data[0])), Str>
|
||||||
operator""_cf() {
|
operator""_cf() {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
@ -316,6 +316,7 @@ TEST(CompileTest, CompileFormatStringLiteral) {
|
|||||||
using namespace fmt::literals;
|
using namespace fmt::literals;
|
||||||
EXPECT_EQ("", fmt::format(""_cf));
|
EXPECT_EQ("", fmt::format(""_cf));
|
||||||
EXPECT_EQ("42", fmt::format("{}"_cf, 42));
|
EXPECT_EQ("42", fmt::format("{}"_cf, 42));
|
||||||
|
EXPECT_EQ(L"42", fmt::format(L"{}"_cf, 42));
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user