The class ctype_base in the header <locale> contains masks for
character classification functions, which are kept in sync with
platform's C library, hence it contains many special cases.
The value of the bit mask regex_word in the header <regex> must not
clash with those bit masks.
Currently the default case (i.e. unknown platform/C library) is
handled incorrectly: the __regex_word clashes with ctype_base::punct.
To avoid replicating the whole list of platforms in <regex> this patch
defines regex_word in <locale>, so that it is always kept in sync
with other masks.
This change breaks building on mips: https://bugs.llvm.org/show_bug.cgi?id=43011
Maybe this change fix the problem, but I'm not an expert in libc++: