https://gcc.gnu.org/bugzilla/show_bug.cgi?id=119671

            Bug ID: 119671
           Summary: Use-after-free for formatting floating-point types to
                    wide strings
           Product: gcc
           Version: 15.0
            Status: UNCONFIRMED
          Keywords: wrong-code
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

#include <format>
#include <cassert>

int main()
{
  auto loc = std::locale::classic();
  assert(std::format(loc, "{:L}\n", 1.23) == "1.23");
  assert(std::format(loc, L"{:L}\n", 1.23) != std::wstring(L"\0.23", 4));
}

The second assertion fails.

Reply via email to