[cfe-dev] Bug in libc++

Aleksandr via cfe-dev cfe-dev at lists.llvm.org
Mon Aug 21 06:54:22 PDT 2017


Hello,
I am newcomer, and I don't where I should post it.
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";
     else
         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



More information about the cfe-dev mailing list