https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92688
Bug ID: 92688 Summary: including <regex> introduce the name index to global namespace scope Product: gcc Version: 10.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: boostcpp at gmail dot com Target Milestone: --- This code introduce regression after GCC 4.9 and onward. #include <regex> template < typename T > struct index { } int main() { } Also, this code fails to compile even at GCC 4.4.7(I don't have an easy test environment of GCC older than this version) #include <cstring> int index ; int main(){} The reason is <regex> include <cstring>, which include <string.h> which has a function name index on global namespace scope. The index function was originally came from <strings.h>. For some reason, its name is declared on default in <string.h> <strings.h> and its index function is not part of the C++ standard nor C standard. it has been deprecated long ago. GCC without GNU extention(like with option -std=c++XX) shall not pollute the global namespace scope with the non-standard conforming library name that is so generic like "index" if it only include the standard library header files.