[libcxx-commits] [libcxx] [regex] fix uncaught exception when string is like "\\_" (PR #129348)

via libcxx-commits libcxx-commits at lists.llvm.org
Fri Feb 28 18:44:11 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Austin (Zhenhang1213)

<details>
<summary>Changes</summary>

fixes #<!-- -->129062

---
Full diff: https://github.com/llvm/llvm-project/pull/129348.diff


1 Files Affected:

- (modified) libcxx/include/regex (+1-1) 


``````````diff
diff --git a/libcxx/include/regex b/libcxx/include/regex
index 36ea55ce30921..6916f91628821 100644
--- a/libcxx/include/regex
+++ b/libcxx/include/regex
@@ -3954,7 +3954,7 @@ _ForwardIterator basic_regex<_CharT, _Traits>::__parse_character_escape(
       ++__first;
       break;
     default:
-      if (*__first != '_' && !__traits_.isctype(*__first, ctype_base::alnum)) {
+      if (!__traits_.isctype(*__first, ctype_base::alnum)) {
         if (__str)
           *__str = *__first;
         else

``````````

</details>


https://github.com/llvm/llvm-project/pull/129348


More information about the libcxx-commits mailing list