Boost logo

Boost :

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


On Saturday 22 March 2014 17:22:16 Brian Ravnsgaard Riis wrote:
> On 2014-03-22 17:00, Andrey Semashev wrote:
> > 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++?
>
> The regex implementation in gcc's libstdc++ up to 4.8.x is incomplete.
> To say the least! Rumour has it it'll be available in 4.9. Previous
> versions implemented enough interface to compile, but it will not
> actually work.
>
> Stick with boost until 4.9 is available.

Ok, thanks for the information. I've created a pull request for Boost.Config:

https://github.com/boostorg/config/pull/12


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