fmt/include
Marvel Harisson 2e60743c67
Fix formatting of nullptr with FMT_COMPILE and to_string (#4993)
* Fix formatting of nullptr with FMT_COMPILE and to_string

std::nullptr_t is implicitly convertible to string_view and const char*,
so compiled format strings and fmt::to_string treated nullptr as a null
C string: FMT_COMPILE("{}!") crashed and FMT_COMPILE("{}") and to_string
threw "string pointer is null". Format it as a pointer ("0x0") like the
runtime API does.

* Write nullptr as a pointer in detail::write

detail::write<Char>(out, nullptr) picked the const Char* overload, so
fmt::to_string(nullptr) and FMT_COMPILE("{}") threw "string pointer is
null". Add a nullptr_t overload that forwards to the const void* one.
2026-10-25 09:30:45 -07:00
..
fmt Fix formatting of nullptr with FMT_COMPILE and to_string (#4993) 2026-10-25 09:30:45 -07:00