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

            Bug ID: 113398
           Summary: <string> no longer usable with -ffreestanding
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
  Target Milestone: ---

This used to work with GCC 12 when compiled with -ffreestanding

#include <string>

// Defined by the user.
void* operator new(std::size_t n);
void operator delete(void*, std::size_t n);

int main()
{
  std::string s = "a string that needs to allocate from the heap";
  return s.size();
}


Since GCC 13 the -ffreestanding option also selects a freestanding libstdc++,
which doesn't allow std::string to be used.

The change was done intentionally, to provide a more clearly defined and
documented freestanding library, but it removes functionality that was being
used.

Reply via email to