https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78905
Bug ID: 78905 Summary: Add a macro to determine that the <regex> library is implemented Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: mattyclarkson at gmail dot com Target Milestone: --- libstdc++ 4.7 and 4.8 shipped with a incomplete <regex> implementation. Detecting this is a bit of a pain. I did my best to attempt a detection snippet with: #include <regex> #if __cplusplus >= 201103L && \ (!defined(__GLIBCXX__) || (__cplusplus >= 201402L) || \ (defined(_GLIBCXX_REGEX_DFS_QUANTIFIERS_LIMIT) || \ defined(_GLIBCXX_REGEX_STATE_LIMIT))) #define HAVE_WORKING_REGEX 1 #else #define HAVE_WORKING_REGEX 0 #endif This uses internal macros that are not guaranteed to exist. Would it be possible to include a _GLIBCXX_REGEX_IMPLEMENTED (or similar) that would be supported in future versions of the library so that the snippet can be updated so that it doesn't break for future versions of the library? I wrote a more lengthy description of the solution on stackoverflow: http://stackoverflow.com/a/41186162/192993