https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85824
--- Comment #7 from Jonathan Wakely <redi at gcc dot gnu.org> --- I don't know if this has anything to do with regex_constants::collate because that affects character ranges like "[a-z]". Does that include "[[=A=]]"? My assumption is it's only for hyphenated ranges, not any thing in a bracket expression. The exception happens from the transform_primary call in _BracketMatcher::_M_apply while populating the _BracketMatcher cache. The transform_primary call is for equivalence classes [=A=] and I don't think the regex_constants::collate flag applies to those. So checking __collate would be wrong. But the r15-6317-geb339c29ee42aa change was a nice improvement.