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

--- Comment #11 from Luca Bacci <luca.bacci at outlook dot com> ---
The problem happens in
https://github.com/gcc-mirror/gcc/blob/releases/gcc-14.2.0/libstdc%2B%2B-v3/include/bits/regex_compiler.tcc#L612.
_M_translator takes __collate (the std::regex::collate flag) in account, so
it's not an issue; however _M_traits (which is the std::regex_traits) uses the
locale.

We can see that _M_traits.transform_primary() is called to search into the
_M_equiv_set vector, but in most cases _M_equiv_set is empty. So I'd suggest to
add a check:

  if (!_M_equiv_set.empty() &&
      std::find(_M_equiv_set.begin(), _M_equiv_set.end(),
               _M_traits.transform_primary(&__ch, &__ch+1)) !=
_M_equiv_set.end())
    return true;

That way the locale-dependant _M_traits.transform_primary is only called if
needed.

Reply via email to