https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98723
--- Comment #15 from GCC Commits <cvs-commit at gcc dot gnu.org> --- The master branch has been updated by Jonathan Wakely <r...@gcc.gnu.org>: https://gcc.gnu.org/g:eb339c29ee42aa59591fc50d6d8a1ab903d2a3fe commit r15-6317-geb339c29ee42aa59591fc50d6d8a1ab903d2a3fe Author: Luca Bacci <luca.bacci...@gmail.com> Date: Tue Dec 17 18:57:30 2024 +0000 libstdc++: Call regex_traits::transform_primary() only when necessary [PR98723] This is both a performance optimization and a partial fix for PR 98723. This commit fixes the issue for bracket expressions that do not depend on the locale's collation facet. Examples: * Character ranges ([a-z]) when std::regex::collate is not set * Character classes ([:alnum:]) * Individual characters ([abc]) Signed-off-by: Luca Bacci <luca.bacci...@gmail.com> libstdc++-v3/ChangeLog: PR libstdc++/98723 * include/bits/regex_compiler.tcc (_BracketMatcher::_M_apply): Only use transform_primary when an equivalence set is used.