https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78236
--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Thu May 18 15:30:42 2017 New Revision: 248230 URL: https://gcc.gnu.org/viewcvs?rev=248230&root=gcc&view=rev Log: libstdc++/78236 fix past-the-end std::regex_iterator Backport from mainline 2016-11-09 Tim Shen <tims...@google.com> PR libstdc++/78236 * libstdc++-v3/include/bits/regex.h (regex_iterator::regex_iterator()): Define end() as _M_pregex == nullptr. * libstdc++-v3/include/bits/regex.tcc (regex_iterator::operator==(), regex_iterator::operator++()): Fix operator==() and operator++() to look at null-ness of _M_pregex on both sides. * testsuite/28_regex/regression.cc: New testcase. Modified: branches/gcc-5-branch/libstdc++-v3/ChangeLog branches/gcc-5-branch/libstdc++-v3/include/bits/regex.h branches/gcc-5-branch/libstdc++-v3/include/bits/regex.tcc branches/gcc-5-branch/libstdc++-v3/testsuite/28_regex/regression.cc