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

            Bug ID: 111713
           Summary: libstdc++ accepts regular expression
           Product: gcc
           Version: 14.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: hewillk at gmail dot com
  Target Milestone: ---

#include <regex>
#include <iostream>
#include <cassert>

int main() {
  std::regex invalid_re("AAA\\s*(\\w+*)"); // should throw
  std::smatch match;
  std::string str("AAA BBB");
  assert(std::regex_match(str, match, invalid_re));
  std::cout << match[1] << "\n"; // libstdc++ prints BBB
}

https://godbolt.org/z/1zrv1Wf71

Reply via email to