Skip to content

Add consteval format string checks for wide strings #2390

@alabuzhev

Description

@alabuzhev

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions