https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102958
--- Comment #8 from Jonathan Wakely <redi at gcc dot gnu.org> --- Fixing the underlying optimization issue might be nice, but I don't see any reason why std::char_traits<char8_t>::length can't simply use strlen. We'd only need to cast it to const char* (which is fine because we won't do that for constexpr evaluation). char(0) and char8_t(0) have the same bits after all.