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

            Bug ID: 83600
           Summary: std::match_results C++14 conformance issue: iterators
                    not equal
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: andrey.y.guskov at intel dot com
  Target Milestone: ---

C++14 Standard (see here:
http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2014/n4296.pdf), section
28.10:

The class template match_results shall satisfy the requirements of an
allocator-aware container and of a sequence container, as specified in 23.2.3


Container requirements, section 23.2.1:

Expression: a.empty() 
Return type: convertible to bool
Operational semantics: a.begin() == a.end()


Section 24.7:

template <class C> auto begin(C& c) -> decltype(c.begin());
template <class C> auto begin(const C& c) -> decltype(c.begin());
Returns: c.begin().
template <class C> auto end(C& c) -> decltype(c.end());
template <class C> auto end(const C& c) -> decltype(c.end());
Returns: c.end().


Creating an empty instance of match_results<char*> container and then comparing
its begin and end iterators results in a mismatch, whereas according to the
standard they have to be the same:


#include <regex>
int main() {
std::match_results<char*> m;
return !printf((std::begin(m) == std::end(m))? "PASS\n" : "FAIL\n");
}

Reply via email to