public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/102447] New: std::regex incorrectly accepts invalid bracket expression
@ 2021-09-22 10:06 redi at gcc dot gnu.org
  2021-09-24 18:50 ` [Bug libstdc++/102447] " mpolacek at gcc dot gnu.org
                   ` (15 more replies)
  0 siblings, 16 replies; 17+ messages in thread
From: redi at gcc dot gnu.org @ 2021-09-22 10:06 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 102447
           Summary: std::regex incorrectly accepts invalid bracket
                    expression
           Product: gcc
           Version: 12.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: redi at gcc dot gnu.org
            Blocks: 102445
  Target Milestone: ---

#include <regex>
#include <cassert>

int main()
{
  try {
    std::regex{"[\\w-a]"};
    assert(!"here");
  } catch (const std::regex_error& e) {
    assert(e.code() == std::regex_constants::error_range);
  }
}

This should run and exit successfully, but with GCC we get:

a.out: reg.C:8: int main(): Assertion `!"here"' failed.
Aborted (core dumped)


The bracket expression [\w-a] is invalid.


Referenced Bugs:

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102445
[Bug 102445] [meta-bug] std::regex issues

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

end of thread, other threads:[~2023-06-23 16:18 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-22 10:06 [Bug libstdc++/102447] New: std::regex incorrectly accepts invalid bracket expression redi at gcc dot gnu.org
2021-09-24 18:50 ` [Bug libstdc++/102447] " mpolacek at gcc dot gnu.org
2021-09-24 19:03 ` redi at gcc dot gnu.org
2021-09-24 21:32 ` redi at gcc dot gnu.org
2021-09-27 11:45 ` redi at gcc dot gnu.org
2021-10-01 10:24 ` redi at gcc dot gnu.org
2021-10-02  1:28 ` rs2740 at gmail dot com
2021-10-02  6:55 ` redi at gcc dot gnu.org
2021-10-02 16:54 ` rs2740 at gmail dot com
2021-10-04  5:09 ` s.ikarashi at fujitsu dot com
2021-12-13 22:27 ` redi at gcc dot gnu.org
2021-12-14 21:47 ` cvs-commit at gcc dot gnu.org
2021-12-14 21:51 ` redi at gcc dot gnu.org
2022-07-07 23:33 ` cvs-commit at gcc dot gnu.org
2022-07-07 23:37 ` redi at gcc dot gnu.org
2023-06-23 16:12 ` cvs-commit at gcc dot gnu.org
2023-06-23 16:18 ` 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).