[llvm-bugs] [Bug 39575] New: std::regex(R"(^[\w-a]$)") fails (std::regex(R"(^[-\wa]$)") succeeds)

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Nov 7 00:36:54 PST 2018


https://bugs.llvm.org/show_bug.cgi?id=39575

            Bug ID: 39575
           Summary: std::regex(R"(^[\w-a]$)") fails
                    (std::regex(R"(^[-\wa]$)") succeeds)
           Product: libc++
           Version: 7.0
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: nishida_kenji at nintendo.co.jp
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

Code tested on https://wandbox.org/
--------------------------
#include <iostream>
#include <regex>
int main() {
  std::regex re;
  try {
    // std::regex(R"(^[-\wa]$)"), std::regex(R"(^[\w-]$)")
    // are ok for libc++
    re = std::regex(R"(^[\w-a]$)");
  } catch ( const std::regex_error& err ) {
    // 1:The expression contained an invalid collating element name.
    std::cout << err.code() << ':' << err.what() << std::endl;
    std::abort();
  }
  std::cout << std::regex_search(R"(-)", re) << std::endl;
}
--------------------------
This code throws the exception on clang 7.0.0(and 8.0.0).
It does not throw on gcc.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20181107/b07fb001/attachment.html>


More information about the llvm-bugs mailing list