When passing to the std::regex constructor a pattern that include an escaped underscore ("\_"), an exception is thrown with the explanation "The expression contained an invalid escaped character, or a trailing escape." This does not occur on non-FreeBSD systems, and it does not occur for several other escapes that are normally invalid by regex convention (e.g., \& \= \/). Is this intentional?
(In reply to Milo Cooper from comment #0) If std::regex is just a shim for libc regex(3), then yes, this is expected. As of 13.0-ish, we've started rejecting many escapes of ordinary characters (this is UB according to POSIX, and shouldn't be considered portable). Some of them are imbued with special meaning by libregex to match GNU expectations (e.g., \w/\W, \b/\B, \s/\S, \<, \>), so we're trying to avoid some confusion by not having a "working" expression in both libc and libregex -- it either compiles and you get the GNU behavior, or it doesn't compile and you're made aware that you need libregex if you expected GNU behavior.