https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66359
--- Comment #3 from ge...@schorsch-tech.de --- I tried to apply that revision to gcc-4.9.2. Now i get the following error. g++ -DUSE_STD -std=c++11 main.cpp In file included from /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4/regex:58:0, from main.cpp:2: /usr/lib/gcc/x86_64-pc-linux-gnu/4.9.2/include/g++-v4/bits/regex.h:65:5: warning: inline function 'std::shared_ptr<std::__detail::_NFA<_TraitsT> > std::__detail::__compile_nfa(const typename _TraitsT::char_type*, const typename _TraitsT::char_type*, const _TraitsT&, std::regex_constants::syntax_option_type) [with _TraitsT = std::regex_traits<char>; typename _TraitsT::char_type = char]' used but never defined __compile_nfa(const typename _TraitsT::char_type* __first, ^ /tmp/ccMywN21.o: In function `std::basic_regex<char, std::regex_traits<char> >::basic_regex<char const*>(char const*, char const*, std::regex_constants::syntax_option_type)': main.cpp:(.text._ZNSt11basic_regexIcSt12regex_traitsIcEEC2IPKcEET_S6_NSt15regex_constants18syntax_option_typeE[_ZNSt11basic_regexIcSt12regex_traitsIcEEC5IPKcEET_S6_NSt15regex_constants18syntax_option_typeE]+0xd5): undefined reference to `std::shared_ptr<std::__detail::_NFA<std::regex_traits<char> > > std::__detail::__compile_nfa<std::regex_traits<char> >(std::regex_traits<char>::char_type const*, std::regex_traits<char>::char_type const*, std::regex_traits<char> const&, std::regex_constants::syntax_option_type)' collect2: error: ld returned 1 exit status I added my applied patch too. I copied the files from your revision to my tree and used git to create that patch.