https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102958
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Last reconfirmed|2022-12-12 00:00:00 |2025-4-2 --- Comment #11 from Jonathan Wakely <redi at gcc dot gnu.org> --- With current trunk the two functions compile to identical code even at -O1, just returning 9. But that's only because I made char_traits<char8_t>::length use strlen. Before r15-6990-g44d21551362f90 the code for g() was very branchy and included branches that allocate memory, and so can throw bad_alloc. After that commit, the allocations and exceptional path are gone in g(), but we still have two calls to deallocate with _ZdlPvm (which are unreachable because we don't have anything to deallocate!) So things are much better on trunk, but g() is not optimal yet. So I guess we should keep it open.