public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/64781] New: regex out-of-range submatches should represent an unmatched sub-expression
@ 2015-01-25  1:59 kaballo86 at hotmail dot com
  2015-01-27 11:25 ` [Bug libstdc++/64781] " redi at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: kaballo86 at hotmail dot com @ 2015-01-25  1:59 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 64781
           Summary: regex out-of-range submatches should represent an
                    unmatched sub-expression
           Product: gcc
           Version: 5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: kaballo86 at hotmail dot com

The following snippet fails with a runtime assertion:

    #include <regex>
    #include <cassert>

    int main() {
      std::match_results<const char*> m;
      const char s[] = "a";
      assert(std::regex_search(s, m, std::regex("a")));

      assert(m.size() == 1);

      assert(m[0].first == s+0);
      assert(m[0].second == s+1);
      assert(m[0].matched == true);

      assert(m[42].first == s+1); // fires
      assert(m[42].second == s+1); // fires
      assert(m[42].matched == false);
    }

28.10.4 [re.results.acc]/8 says "If `n >= size()` then returns a `sub_match`
object representing an unmatched sub-expression."

While the term "unmatched sub-expression" does not appear anywhere else in the
standard, this is presumably 28.10 [re.results]/4 "If the sub-expression `n`
participated in a regular expression match then the `sub_match` member
`matched` evaluates to `true`, and members `first` and `second` denote the
range of characters `[first,second)` which formed that match. Otherwise
`matched` is `false`, and members `first` and `second` point to the end of the
sequence that was searched."

According to that, `m[n].first == m[n].last == s+1` should hold for `n >= 1`.


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

* [Bug libstdc++/64781] regex out-of-range submatches should represent an unmatched sub-expression
  2015-01-25  1:59 [Bug libstdc++/64781] New: regex out-of-range submatches should represent an unmatched sub-expression kaballo86 at hotmail dot com
@ 2015-01-27 11:25 ` redi at gcc dot gnu.org
  2015-03-09  6:59 ` timshen at gcc dot gnu.org
  2015-03-09 10:08 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-01-27 11:25 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|UNCONFIRMED                 |NEW
   Last reconfirmed|                            |2015-01-27
     Ever confirmed|0                           |1


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

* [Bug libstdc++/64781] regex out-of-range submatches should represent an unmatched sub-expression
  2015-01-25  1:59 [Bug libstdc++/64781] New: regex out-of-range submatches should represent an unmatched sub-expression kaballo86 at hotmail dot com
  2015-01-27 11:25 ` [Bug libstdc++/64781] " redi at gcc dot gnu.org
@ 2015-03-09  6:59 ` timshen at gcc dot gnu.org
  2015-03-09 10:08 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: timshen at gcc dot gnu.org @ 2015-03-09  6:59 UTC (permalink / raw)
  To: gcc-bugs

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

Tim Shen <timshen at gcc dot gnu.org> changed:

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

--- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> ---
Duplicated to 64441.


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

* [Bug libstdc++/64781] regex out-of-range submatches should represent an unmatched sub-expression
  2015-01-25  1:59 [Bug libstdc++/64781] New: regex out-of-range submatches should represent an unmatched sub-expression kaballo86 at hotmail dot com
  2015-01-27 11:25 ` [Bug libstdc++/64781] " redi at gcc dot gnu.org
  2015-03-09  6:59 ` timshen at gcc dot gnu.org
@ 2015-03-09 10:08 ` redi at gcc dot gnu.org
  2 siblings, 0 replies; 4+ messages in thread
From: redi at gcc dot gnu.org @ 2015-03-09 10:08 UTC (permalink / raw)
  To: gcc-bugs

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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|FIXED                       |DUPLICATE

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
This should be resolved as a duplicate, not FIXED.

*** This bug has been marked as a duplicate of bug 64441 ***


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

end of thread, other threads:[~2015-03-09 10:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-25  1:59 [Bug libstdc++/64781] New: regex out-of-range submatches should represent an unmatched sub-expression kaballo86 at hotmail dot com
2015-01-27 11:25 ` [Bug libstdc++/64781] " redi at gcc dot gnu.org
2015-03-09  6:59 ` timshen at gcc dot gnu.org
2015-03-09 10:08 ` 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).