Message ID | 20240801213927.388966-3-jwakely@redhat.com |
---|---|
State | New |
Headers | show |
Series | libstdc++: Use strlen for std::char_traits<char8_t>::length [PR102958] | expand |
diff --git a/libstdc++-v3/include/bits/char_traits.h b/libstdc++-v3/include/bits/char_traits.h index 3074e9bb77e..ac3e43e34b9 100644 --- a/libstdc++-v3/include/bits/char_traits.h +++ b/libstdc++-v3/include/bits/char_traits.h @@ -651,10 +651,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION if (std::__is_constant_evaluated()) return __gnu_cxx::char_traits<char_type>::length(__s); #endif - size_t __i = 0; - while (!eq(__s[__i], char_type())) - ++__i; - return __i; + return __builtin_strlen((const char*)__s); } static _GLIBCXX17_CONSTEXPR const char_type*