public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/94627] New: [9/10 Regression] std::match_results equality comparisons should not be noexcept
@ 2020-04-16 20:50 redi at gcc dot gnu.org
  2020-04-16 20:50 ` [Bug libstdc++/94627] " redi at gcc dot gnu.org
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-04-16 20:50 UTC (permalink / raw)
  To: gcc-bugs

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-07-01 22:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-16 20:50 [Bug libstdc++/94627] New: [9/10 Regression] std::match_results equality comparisons should not be noexcept redi at gcc dot gnu.org
2020-04-16 20:50 ` [Bug libstdc++/94627] " redi at gcc dot gnu.org
2020-04-17  7:03 ` rguenth at gcc dot gnu.org
2020-07-01 20:46 ` [Bug libstdc++/94627] [9/10/11 " cvs-commit at gcc dot gnu.org
2020-07-01 21:57 ` [Bug libstdc++/94627] [9/10 " cvs-commit at gcc dot gnu.org
2020-07-01 22:21 ` cvs-commit at gcc dot gnu.org
2020-07-01 22:21 ` redi at gcc dot gnu.org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).