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

--- Comment #7 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> ---
When I used the match_results::swap on r218710, I got a compilation error.

========================================== sample code
==========================================
#include <regex>

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< <template-parameter-1-1>, <template-parameter-1-2>
>::swap(std::match_results< <template-parameter-1-1>, <template-parameter-1-2>
>&) [with _Bi_iter = const char*; _Alloc = std::allocator<std::sub_match<const
char*> >]':
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<const char*>::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< <template-parameter-1-1>, <template-parameter-1-2>
>::swap(std::match_results< <template-parameter-1-1>, <template-parameter-1-2>
>&) [with _Bi_iter = const char*; _Alloc = std::allocator<std::sub_match<const
char*> >]
       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.

Reply via email to