Reproducing it is simple: #include <iostream> #include <string> #include <regex> using namespace std; int main() { cout << regex_search(string{"int"}, regex{"int"}) << '\n'; return 0; } This *should* print 1, and with libc++ it does. GCC? It prints 0. This had me practically tearing my hair out trying to figure out what was wrong with my regexes! :/ I searched for existing bugs related to this, but couldn't find any. I'm sorry if this is a duplicate...
Iirc regex was not implemented in 4.8.x. Try 4.9 and above.
(In reply to Andrew Pinski from comment #1) > Iirc regex was not implemented in 4.8.x. Try 4.9 and above. ...but then why are the functions present? I would've preferred a compile-time error if that is the case.
Here is rather detailed explanation from Jonathan Wakely (he is the maintainer of libstdc++): https://stackoverflow.com/questions/12530406/is-gcc-4-7-and-gcc-4-8-buggy-about-regular-expressions/12665408
Apart from that 4.8 is not supported anyway, so reporting bugs against it won't achieve anything except being asked to try a current, supported release. If you do that you will find it works in 4.9 and later.