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

            Bug ID: 123895
           Summary: Better error reporting for std::regex
           Product: gcc
           Version: 16.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: ---

For this case taken from Bug 86164 comment 9:

#include <regex>

using namespace std;

int main()
{ 
  regex re ("#+");
  regex_search (string (1024 * 1024 * 1024, '#'), re);
}


The bad_alloc exception from the executor should be caught and a regex_error
thrown instead, with error code regex_constants::error_stack, which means
"There is insufficient memory to determine whether the regular expression
matches the specified character sequence."


Referenced Bugs:

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

Reply via email to