https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78236
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> --- Author: redi Date: Thu May 18 14:34:50 2017 New Revision: 248207 URL: https://gcc.gnu.org/viewcvs?rev=248207&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-6-branch/libstdc++-v3/ChangeLog branches/gcc-6-branch/libstdc++-v3/include/bits/regex.h branches/gcc-6-branch/libstdc++-v3/include/bits/regex.tcc branches/gcc-6-branch/libstdc++-v3/testsuite/28_regex/regression.cc