[llvm-bugs] [Bug 34310] New: libc++ does not correctly handle the regex: "[^\\W]

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 24 06:28:21 PDT 2017


            Bug ID: 34310
           Summary: libc++ does not correctly handle the regex: "[^\\W]
           Product: libc++
           Version: 3.9
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: alex.semenov at samsung.com
                CC: llvm-bugs at lists.llvm.org, mclow.lists at gmail.com

I find bug in libc++ in regex. This is my code sample:

#include <iostream>
#include <regex>
#include <string>

int main() {

    std::string HW("HelloWorld");
    std::regex RE("[^\\W]");

    if (std::regex_search(HW, RE))
        std::cout << "regexp is OK";
        std::cout << "regexp is broken";

    std::cout << std::endl;
    return 0;

This is my command for compilation:
clang++ -std=c++11 -stdlib=libc++ main.cpp

And I get:
regexp is broken

But, if I use libstdc++ :

clang++ -std=c++11 -stdlib=libstdc++ main.cpp

It's ok:
regexp is OK

I get bug only for regexp [^\\W] and for combinations with it.

I use libc++dev form ubuntu version: 3.9.1-2

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/20170824/5b42328e/attachment.html>

More information about the llvm-bugs mailing list