[Bug libstdc++/89927] Inconsistent behavior in std::regex when optimized

timshen at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Apr 2 17:36:00 GMT 2019


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

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

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |timshen at gcc dot gnu.org

--- Comment #1 from Tim Shen <timshen at gcc dot gnu.org> ---
In the example, by
  std::regex(match_name_regex_string, "i");
did you mean
  std::regex_match(
      "i",
      std::regex(match_name_regex_string));
?

The former is UB because match_name_regex_string and "i" form an invalid range
of two const char*.


More information about the Gcc-bugs mailing list