Boost logo

Boost :

Subject: [boost] [config] std::regex unusable on gcc?
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2014-03-22 12:00:28


Hi,

I'm trying to use std::regex and it's failing with even the simplest patterns:

  #include <regex>

  int main(int, char* argv[])
  {
    std::regex rex("\\d");
    return std::regex_match("1", rex);
  }

  g++ -std=c++11 rex_test.cpp -o rex_test
  ./rex_test
  terminate called after throwing an instance of 'std::regex_error'
    what(): regex_error
  Aborted (core dumped)

GCC version: gcc version 4.8.1 (Ubuntu/Linaro 4.8.1-10ubuntu9). GCC 4.7.3
exhibits the same behavior.

Replacing "\\d" pattern with "[0-9]" results in the same failure. It works
with Boost.Regex, Boost.Xpressive and with clang 3.4 & libc++. Am I doing
something wrong?

If my use of std::regex is correct then for me this basically means that
std::regex is unusable. In this case, could we define BOOST_NO_CXX11_HDR_REGEX
in Boost.Config for all versions of libstdc++?


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk