<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - std::regex(R"(^[\w-a]$)") fails (std::regex(R"(^[-\wa]$)") succeeds)"
   href="https://bugs.llvm.org/show_bug.cgi?id=39575">39575</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>std::regex(R"(^[\w-a]$)") fails (std::regex(R"(^[-\wa]$)") succeeds)
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>7.0
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>nishida_kenji@nintendo.co.jp
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Code tested on <a href="https://wandbox.org/">https://wandbox.org/</a>
--------------------------
#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.</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>