https://gcc.gnu.org/bugzilla/show_bug.cgi?id=106044
--- Comment #2 from Chris Uzdavinis <cuzdav at gmail dot com> --- Even marginally simpler: #include <string> auto f() { return "_" + std::string(" "); } Originally I marked it as tree-optimization since it's only with -O3, but it could be an issue in the standard library itself. I didn't consider that initially.