From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9847 invoked by alias); 7 Jan 2015 03:16:35 -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 9788 invoked by uid 48); 7 Jan 2015 03:16:21 -0000 From: "kariya_mitsuru at hotmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/64239] regex_iterator::operator= should copy match_results::position Date: Wed, 07 Jan 2015 03:16: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: kariya_mitsuru at hotmail dot com 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: 2015-01/txt/msg00350.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64239 --- Comment #7 from Mitsuru Kariya --- When I used the match_results::swap on r218710, I got a compilation error. ========================================== sample code ========================================== #include int main() { std::cmatch mm1, mm2; mm1.swap(mm2); } ================================================================================================= ========================================== g++ output =========================================== In file included from /usr/local/gcc-218710/include/c++/5.0.0/regex:59:0, from swap.cpp:1: /usr/local/gcc-218710/include/c++/5.0.0/bits/regex.h: In instantiation of 'void std::match_results< , >::swap(std::match_results< , >&) [with _Bi_iter = const char*; _Alloc = std::allocator >]': swap.cpp:7:15: required from here /usr/local/gcc-218710/include/c++/5.0.0/bits/regex.h:1864:6: error: no matching function for call to 'std::match_results::swap(const char*&, const char*&)' swap(_M_begin, __that._M_begin); ^ /usr/local/gcc-218710/include/c++/5.0.0/bits/regex.h:1861:7: note: candidate: void std::match_results< , >::swap(std::match_results< , >&) [with _Bi_iter = const char*; _Alloc = std::allocator >] swap(match_results& __that) ^ /usr/local/gcc-218710/include/c++/5.0.0/bits/regex.h:1861:7: note: candidate expects 1 argument, 2 provided ================================================================================================= ============================================ g++ -v ============================================= Using built-in specs. COLLECT_GCC=/usr/local/gcc-218710/bin/g++ COLLECT_LTO_WRAPPER=/usr/local/gcc-218710/libexec/gcc/x86_64-unknown-linux-gnu/5.0.0/lto-wrapper Target: x86_64-unknown-linux-gnu Configured with: ../gcc.218710/configure --prefix=/usr/local/gcc-218710 --enable-checking=yes --disable-nls --enable-languages=c,c++,lto Thread model: posix gcc version 5.0.0 20141213 (experimental) (GCC) ================================================================================================= Note that the sample code above was compiled successfully on r218555. I think that the match_results::swap needs "use std::swap;" for swapping _M_begin.