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

* [Bug libstdc++/94627] [9/10 Regression] std::match_results equality comparisons should not be noexcept
  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 ` redi at gcc dot gnu.org
  2020-04-17  7:03 ` rguenth at gcc dot gnu.org
                   ` (4 subsequent siblings)
  5 siblings, 0 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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
      Known to work|                            |8.4.0
     Ever confirmed|0                           |1
           Assignee|unassigned at gcc dot gnu.org      |redi at gcc dot gnu.org
   Target Milestone|---                         |9.4
             Status|UNCONFIRMED                 |ASSIGNED
      Known to fail|                            |10.0, 9.1.0
   Last reconfirmed|                            |2020-04-16

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

* [Bug libstdc++/94627] [9/10 Regression] std::match_results equality comparisons should not be noexcept
  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
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: rguenth at gcc dot gnu.org @ 2020-04-17  7:03 UTC (permalink / raw)
  To: gcc-bugs

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

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P3                          |P2

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

* [Bug libstdc++/94627] [9/10/11 Regression] std::match_results equality comparisons should not be noexcept
  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 ` cvs-commit at gcc dot gnu.org
  2020-07-01 21:57 ` [Bug libstdc++/94627] [9/10 " cvs-commit at gcc dot gnu.org
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-01 20:46 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #1 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:a1a0dc4548979f8a340a7ea71624a52a20e1e0b3

commit r11-1770-ga1a0dc4548979f8a340a7ea71624a52a20e1e0b3
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jul 1 21:01:15 2020 +0100

    libstdc++: Remove noexcept from match_results comparisons (PR 94627)

    These functions can't be noexcept because the iterators stored in the
    sub_match objects can throw on any operation.

    libstdc++-v3/ChangeLog:

            PR libstdc++/94627
            * include/bits/regex.h (operator==, operator!=): Remove noexcept
            equality comparisons for match_results.
            * testsuite/28_regex/match_results/94627.cc: New test.

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

* [Bug libstdc++/94627] [9/10 Regression] std::match_results equality comparisons should not be noexcept
  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
                   ` (2 preceding siblings ...)
  2020-07-01 20:46 ` [Bug libstdc++/94627] [9/10/11 " cvs-commit at gcc dot gnu.org
@ 2020-07-01 21:57 ` 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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-01 21:57 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #2 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-10 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:4c994586cbd40a33f223aaaf90887afe97208543

commit r10-8409-g4c994586cbd40a33f223aaaf90887afe97208543
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jul 1 21:01:15 2020 +0100

    libstdc++: Remove noexcept from match_results comparisons (PR 94627)

    These functions can't be noexcept because the iterators stored in the
    sub_match objects can throw on any operation.

    libstdc++-v3/ChangeLog:

            PR libstdc++/94627
            * include/bits/regex.h (operator==, operator!=): Remove noexcept
            equality comparisons for match_results.
            * testsuite/28_regex/match_results/94627.cc: New test.

    (cherry picked from commit a1a0dc4548979f8a340a7ea71624a52a20e1e0b3)

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

* [Bug libstdc++/94627] [9/10 Regression] std::match_results equality comparisons should not be noexcept
  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
                   ` (3 preceding siblings ...)
  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
  5 siblings, 0 replies; 7+ messages in thread
From: cvs-commit at gcc dot gnu.org @ 2020-07-01 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

--- Comment #3 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The releases/gcc-9 branch has been updated by Jonathan Wakely
<redi@gcc.gnu.org>:

https://gcc.gnu.org/g:e4490e7771e4df28427cca5e113afe58a7fff8d5

commit r9-8713-ge4490e7771e4df28427cca5e113afe58a7fff8d5
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Wed Jul 1 21:01:15 2020 +0100

    libstdc++: Remove noexcept from match_results comparisons (PR 94627)

    These functions can't be noexcept because the iterators stored in the
    sub_match objects can throw on any operation.

    libstdc++-v3/ChangeLog:

            PR libstdc++/94627
            * include/bits/regex.h (operator==, operator!=): Remove noexcept
            equality comparisons for match_results.
            * testsuite/28_regex/match_results/94627.cc: New test.

    (cherry picked from commit a1a0dc4548979f8a340a7ea71624a52a20e1e0b3)

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

* [Bug libstdc++/94627] [9/10 Regression] std::match_results equality comparisons should not be noexcept
  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
                   ` (4 preceding siblings ...)
  2020-07-01 22:21 ` cvs-commit at gcc dot gnu.org
@ 2020-07-01 22:21 ` redi at gcc dot gnu.org
  5 siblings, 0 replies; 7+ messages in thread
From: redi at gcc dot gnu.org @ 2020-07-01 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

Jonathan Wakely <redi at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |FIXED
             Status|ASSIGNED                    |RESOLVED

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Fixed for 9.4 and 10.2

^ 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).