From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9772 invoked by alias); 11 Dec 2014 06:52:18 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9727 invoked by uid 48); 11 Dec 2014 06:52:14 -0000 From: "timshen at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/64239] regex_iterator::operator= should copy match_results::position Date: Thu, 11 Dec 2014 06:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 5.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: timshen at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-12/txt/msg01215.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64239 --- Comment #4 from Tim Shen --- Sorry, I was once thinking that we should always use match_results::prefix().first as the "start position of a match". It's true for regex_match and regex_search, but not true for regex_iterator. That's why match_results::_M_begin exists. _M_in_iterator was just a dumb mistake that I can't even understand now, probably for my misunderstanding on the "start position of a match". Sorry :( Also, obviously I forgot to update ctor/assign/swap after adding match_results::_M_match. I'm testing the patch that fixes this. Later I'll post it in the mailing list. It removes _M_in_iterator. To backport it to 4.9 branch, _M_in_iterator needs to remain. Thanks for reporting and investigating!