Skip to content

FormatError when formatting empty std::string_view #689

Closed
@dermojo

Description

@dermojo

When trying to format an empty string_view, fmtlib raises a FormatError because the contained pointer is nullptr. Minimal example:

#include <string_view>
#include <fmt/format.h>

int main()
{
  std::string_view x;
  fmt::print("{}\n", x);
  return 0;
}

I'd expect an empty string to be printed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions