fmt
fmt copied to clipboard
Add consteval format string checks for wide strings
char
-strings are properly rejected, but the same wchar_t
-strings are happily compiled.
Example:
#include <string>
#include <string_view>
#include <fmt/core.h>
#include <fmt/xchar.h>
using namespace std::literals;
int main()
{
fmt::format(L"{:d}", L"I am not a number");
fmt::format(L"{:d}"s, L"I am not a number");
fmt::format(L"{:d}"sv, L"I am not a number");
fmt::format("{:d}", "I am not a number");
fmt::format("{:d}"s, "I am not a number");
fmt::format("{:d}"sv, "I am not a number");
}
Godbolt: https://godbolt.org/z/jKr43Tqfs
Yeah, compile-time checks are currently enabled for the char
overloads only.
We also need to do this for function taking text styles and potentially named arguments.
This has been implemented in {fmt} v9.