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: unassignedclangb...@nondot.org
          Reporter: nishida_ke...@nintendo.co.jp
                CC: llvm-bugs@lists.llvm.org, mclow.li...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to