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

Paul le roux <pleroux0 at outlook dot com> changed:

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

--- Comment #3 from Paul le roux <pleroux0 at outlook dot com> ---
Okay. I see what went wrong.

The intended code should be

`std::regex(match_name_regex_string, std::regex::icase);`

It is clearly my code that is broken.

For anyone that stumbles upon this and have the same issue:

My code selected this overload (from
https://en.cppreference.com/w/cpp/regex/basic_regex/basic_regex):

`template< class ForwardIt >
basic_regex( ForwardIt first, ForwardIt last, 
             flag_type f = std::regex_constants::ECMAScript );`

which is wrong and the rest is undefined behavior magic.

Is there a reason why a check can't be put in that also triggers in debug mode
(without `-D_GLIBCXX_ASSERTIONS`)? The path is only taken for invalid input so
it won't affect working code and it will immediately inform anyone precisely
what went wrong.

Something like `assert(false && "c-string terminated with \'\\0\' before
sentinel was reached");` just before or after the `__glibc_assert`.

Reply via email to