https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61227
Jonathan Wakely <redi at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Last reconfirmed| |2014-05-19 CC| |timshen at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> --- Only your first and last regexes give an error, it would be helpful if you said what you expect them to do. The sequence \w is intepreted as [_[:alnum:]] but is rejected inside a bracket expression. Reduced: #include <regex> int main() { std::regex{ R"([\w])" }; } For this to match a string such as "w" or "\\" it should be R"([\\w])" To use the special \w class you can use [_[:alnum:]] as a workaround. Tim, could you take a look at this please? I don't think the C++ standard is clear, but Perl does interpret [\w] as equivalent to just \w so I think we should do the same.