Skip to content

:c may overflow with integral values #4839

Description

@igoloe

Prerequisite

char is signed

Description

Using fmt::format("{:c}", int{-104})") ends up with overflowing instead of casting to char.

repro on godbolt.

Expected Behavior:

c: Copies the character static_cast(value) to the output, where CharT is the character type of the format string. Throws std::format_error if value is not in the range of representable values for CharT (cppref).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions