mirror of
https://github.com/fmtlib/fmt.git
synced 2026-04-30 19:09:22 +08:00
Avoid dropping null byte in format string
This commit is contained in:
parent
9396f77fe4
commit
2e58c3a82f
@ -2690,16 +2690,16 @@ template <typename... T> struct fstring {
|
||||
static_assert(count<(is_view<remove_cvref_t<T>>::value &&
|
||||
std::is_reference<T>::value)...>() == 0,
|
||||
"passing views as lvalues is disallowed");
|
||||
if (FMT_USE_CONSTEVAL) parse_format_string<char>(s, checker(s, arg_pack()));
|
||||
if (FMT_USE_CONSTEVAL)
|
||||
parse_format_string<char>(str, checker(str, arg_pack()));
|
||||
constexpr bool unused = detail::enforce_compile_checks<sizeof(s) != 0>();
|
||||
(void)unused;
|
||||
}
|
||||
template <typename S,
|
||||
FMT_ENABLE_IF(std::is_convertible<const S&, string_view>::value)>
|
||||
FMT_CONSTEVAL FMT_ALWAYS_INLINE fstring(const S& s) : str(s) {
|
||||
auto sv = string_view(str);
|
||||
if (FMT_USE_CONSTEVAL)
|
||||
detail::parse_format_string<char>(sv, checker(sv, arg_pack()));
|
||||
detail::parse_format_string<char>(str, checker(str, arg_pack()));
|
||||
constexpr bool unused = detail::enforce_compile_checks<sizeof(s) != 0>();
|
||||
(void)unused;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user