This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/65470] regex_search corrupts matches when haystack is destroyed


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

--- Comment #4 from aral at gmx dot de ---
Addition: after you referred to the properties of match_results, I had a look
at

  http://en.cppreference.com/w/cpp/regex/match_results

which has a clearer wording. However, I still think this clear statement
  => "it's undefined behavior to examine std::match_results if the original
character sequence was destroyed or iterators to it were invalidated for other
reasons"

should be added to the description of the functions that populate the
match_results. "The user" (I, in this case) does not always check the
descriptions of every single function parameter if the function description
seems to give all the information needed to use it.

What could be improved (to avoid bugs going undetected) is to raise an
exception if the match_results are accessed after the haystack has been
destroyed.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]