mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-29 18:27:40 +02:00
Don't assume repeated evaluation of string literal produce the same pointer
Patch by @zygoloid (#4177).
This commit is contained in:
@ -2660,8 +2660,9 @@ template <typename... T> struct fstring {
|
||||
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) {
|
||||
FMT_CONSTEXPR auto sv = string_view(S());
|
||||
if (FMT_USE_CONSTEVAL)
|
||||
detail::parse_format_string<char>(s, checker(s, arg_pack()));
|
||||
detail::parse_format_string<char>(sv, checker(sv, arg_pack()));
|
||||
#ifdef FMT_ENFORCE_COMPILE_STRING
|
||||
static_assert(
|
||||
FMT_USE_CONSTEVAL && sizeof(s) != 0,
|
||||
|
Reference in New Issue
Block a user