https://gcc.gnu.org/bugzilla/show_bug.cgi?id=94627
Bug ID: 94627 Summary: [9/10 Regression] std::match_results equality comparisons should not be noexcept Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: redi at gcc dot gnu.org Target Milestone: --- This should exit cleanly: #include <regex> struct iterator { using value_type = char; using difference_type = std::ptrdiff_t; using reference = char&; using pointer = char*; using iterator_category = std::bidirectional_iterator_tag; iterator() : ptr() { } explicit iterator(pointer p) : ptr(p) { } iterator& operator++() { if (bang) throw 1; ++ptr; return *this; } iterator operator++(int) { auto copy = *this; ++*this; return copy; } iterator& operator--() { if (bang) throw 1; --ptr; return *this; } iterator operator--(int) { auto copy = *this; --*this; return copy; } reference operator*() const noexcept { return *ptr; } pointer operator->() const noexcept { return ptr; } bool operator==(iterator rhs) const noexcept { return ptr == rhs.ptr; } bool operator!=(iterator rhs) const noexcept { return ptr != rhs.ptr; } static bool bang; private: pointer ptr; }; bool iterator::bang = false; int main() { char str[] = "abc"; std::regex r(str); std::match_results<iterator> m; std::regex_match(iterator(str), iterator(str+3), m, r); iterator::bang = true; try { m == m; } catch (int) { } } Since g:c962b2c36f12 it terninates because I incorrectly added noexcept to the operator== and operator!= for std::match_results