This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/65470] regex_search corrupts matches when haystack is destroyed
- From: "aral at gmx dot de" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 19 Mar 2015 19:16:26 +0000
- Subject: [Bug libstdc++/65470] regex_search corrupts matches when haystack is destroyed
- Auto-submitted: auto-generated
- References: <bug-65470-4 at http dot gcc dot gnu dot org/bugzilla/>
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65470
--- Comment #3 from aral at gmx dot de ---
I don't argue that it might be a misunderstanding of the user, hence my
suggestion 1) - however, I disagree with your wording "clearly documented" as
far as
(a) http://en.cppreference.com/w/cpp/regex/regex_search and
(b) http://www.cplusplus.com/reference/regex/regex_search/
are concerned. I could not find any clear statement on "c++ official language
reference" with a google search. Is (a) official?
Either way, (a) states
"7) The overload 3 is prohibited from accepting temporary strings, otherwise
this function populates match_results m with string iterators that become
invalid immediately."
I do not find this very clear, especially since 7) is denoted "since C++14",
and the temporary strings are already a problem in C++11.
How about a statement like this for 2), 3), 5) and 6)? And maybe a clearer
wording? I find the abscence of such a warning, along with the "const"
statement in the parameter declaration (indicating one could submit a string
literal for const charT* s) misleading to say the least.