public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64303] New: The regex_token_iterator's copy constructor creates an incorrect iterator
@ 2014-12-14 10:38 kariya_mitsuru at hotmail dot com
2014-12-17 9:26 ` [Bug libstdc++/64303] " timshen at gcc dot gnu.org
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: kariya_mitsuru at hotmail dot com @ 2014-12-14 10:38 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64303
Bug ID: 64303
Summary: The regex_token_iterator's copy constructor creates an
incorrect iterator
Product: gcc
Version: 5.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: kariya_mitsuru at hotmail dot com
Created attachment 34278
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=34278&action=edit
g++ -v
Please see the following sample.
========================================== sample code
==========================================
#include <iostream>
#include <regex>
#include <string>
int main()
{
const std::string s(" 111 222 ");
const std::regex re("\\w+");
std::sregex_token_iterator it1(s.begin(), s.end(), re), it2(it1), end;
for (; it1 != end; ++it1) {
std::cout << "range = (" << it1->first - s.begin() << ", " << it1->second -
s.begin() << "), "
"str = '" << it1->str() << '\'' << std::endl;
}
std::cout << std::endl;
for (; it2 != end; ++it2) {
std::cout << "range = (" << it2->first - s.begin() << ", " << it2->second -
s.begin() << "), "
"str = '" << it2->str() << '\'' << std::endl;
}
}
=================================================================================================
============================= output =============================
range = (2, 5), str = '111'
range = (7, 10), str = '222'
range = (488, 10), str = ''
range = (7, 10), str = '222'
==================================================================
cf. http://melpon.org/wandbox/permlink/Dbb2PcGdnNeNon2r
Though the C++11 standard says nothing about the regex_token_iterator's copy
constructor, I think that *it2 should be equal to *it1.
So, the output should be
============================= output =============================
range = (2, 5), str = '111'
range = (7, 10), str = '222'
range = (2, 5), str = '111'
range = (7, 10), str = '222'
==================================================================
Note that the operator= is a same result.
cf. http://melpon.org/wandbox/permlink/doxdyo4AfiFM6UMK
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64303] The regex_token_iterator's copy constructor creates an incorrect iterator
2014-12-14 10:38 [Bug libstdc++/64303] New: The regex_token_iterator's copy constructor creates an incorrect iterator kariya_mitsuru at hotmail dot com
@ 2014-12-17 9:26 ` timshen at gcc dot gnu.org
2014-12-17 10:27 ` timshen at gcc dot gnu.org
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: timshen at gcc dot gnu.org @ 2014-12-17 9:26 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64303
--- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Wed Dec 17 09:25:44 2014
New Revision: 218810
URL: https://gcc.gnu.org/viewcvs?rev=218810&root=gcc&view=rev
Log:
PR libstdc++/64302
PR libstdc++/64303
* include/bits/regex.h (match_results::cbegin, match_results::cend,
regex_token_iterator::regex_token_iterator,
regex_token_iterator::_M_normalize_result): Fix match_results cbegin
and cend and regex_token_iterator::_M_result invariant.
* include/bits/regex.tcc: Fix regex_token_iterator::_M_result invariant.
* testsuite/28_regex/iterators/regex_token_iterator/64303.cc: Testcase.
Added:
trunk/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc
Modified:
trunk/libstdc++-v3/ChangeLog
trunk/libstdc++-v3/include/bits/regex.h
trunk/libstdc++-v3/include/bits/regex.tcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64303] The regex_token_iterator's copy constructor creates an incorrect iterator
2014-12-14 10:38 [Bug libstdc++/64303] New: The regex_token_iterator's copy constructor creates an incorrect iterator kariya_mitsuru at hotmail dot com
2014-12-17 9:26 ` [Bug libstdc++/64303] " timshen at gcc dot gnu.org
@ 2014-12-17 10:27 ` timshen at gcc dot gnu.org
2015-03-09 6:46 ` timshen at gcc dot gnu.org
2023-07-20 11:42 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: timshen at gcc dot gnu.org @ 2014-12-17 10:27 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64303
--- Comment #2 from Tim Shen <timshen at gcc dot gnu.org> ---
Author: timshen
Date: Wed Dec 17 10:27:21 2014
New Revision: 218814
URL: https://gcc.gnu.org/viewcvs?rev=218814&root=gcc&view=rev
Log:
2014-12-17 Tim Shen <timshen@google.com>
PR libstdc++/64302
PR libstdc++/64303
Backported form mainline
2014-12-17 Tim Shen <timshen@google.com>
* include/bits/regex.h (match_results::cbegin, match_results::cend,
regex_token_iterator::regex_token_iterator,
regex_token_iterator::_M_normalize_result): Fix match_results cbegin
and cend and regex_token_iterator::_M_result invariant.
* include/bits/regex.tcc: Fix regex_token_iterator::_M_result invariant.
* testsuite/28_regex/iterators/regex_token_iterator/64303.cc: Testcase.
Added:
branches/gcc-4_9-branch/libstdc++-v3/testsuite/28_regex/iterators/regex_token_iterator/64303.cc
Modified:
branches/gcc-4_9-branch/libstdc++-v3/ChangeLog
branches/gcc-4_9-branch/libstdc++-v3/include/bits/regex.h
branches/gcc-4_9-branch/libstdc++-v3/include/bits/regex.tcc
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64303] The regex_token_iterator's copy constructor creates an incorrect iterator
2014-12-14 10:38 [Bug libstdc++/64303] New: The regex_token_iterator's copy constructor creates an incorrect iterator kariya_mitsuru at hotmail dot com
2014-12-17 9:26 ` [Bug libstdc++/64303] " timshen at gcc dot gnu.org
2014-12-17 10:27 ` timshen at gcc dot gnu.org
@ 2015-03-09 6:46 ` timshen at gcc dot gnu.org
2023-07-20 11:42 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-03-09 6:46 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64303
Tim Shen <timshen at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution|--- |FIXED
--- Comment #3 from Tim Shen <timshen at gcc dot gnu.org> ---
Resolved.
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Bug libstdc++/64303] The regex_token_iterator's copy constructor creates an incorrect iterator
2014-12-14 10:38 [Bug libstdc++/64303] New: The regex_token_iterator's copy constructor creates an incorrect iterator kariya_mitsuru at hotmail dot com
` (2 preceding siblings ...)
2015-03-09 6:46 ` timshen at gcc dot gnu.org
@ 2023-07-20 11:42 ` redi at gcc dot gnu.org
3 siblings, 0 replies; 5+ messages in thread
From: redi at gcc dot gnu.org @ 2023-07-20 11:42 UTC (permalink / raw)
To: gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64303
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Target Milestone|--- |4.9.3
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-07-20 11:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-14 10:38 [Bug libstdc++/64303] New: The regex_token_iterator's copy constructor creates an incorrect iterator kariya_mitsuru at hotmail dot com
2014-12-17 9:26 ` [Bug libstdc++/64303] " timshen at gcc dot gnu.org
2014-12-17 10:27 ` timshen at gcc dot gnu.org
2015-03-09 6:46 ` timshen at gcc dot gnu.org
2023-07-20 11:42 ` redi at gcc dot gnu.org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).