https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65470
Daniel Krügler <daniel.kruegler at googlemail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |daniel.kruegler@googlemail. | |com --- Comment #2 from Daniel Krügler <daniel.kruegler at googlemail dot com> --- The behaviour is intended and clearly documented by the specification of the Standard Library: match_results, such as cmath, just hold weak references (via its sub_match elements) to the original search sequence, so (2) is definitively not an option. This doesn't look like a defect to me, this is just a misunderstanding of the user about the semantics of std::regex_search.