Regex/locale libcxx test failure on FreeBSD

The test is

This assertion fails on FreeBSD:

         std::cmatch m;
         const char s = "m";
         assert(std::regex_match(s, m, std::regex("[a[=M=]z]",

From the looks of it, "m" should not match "[=M=]". M is not a special letter in Czech, as far as I know, and the match is case-sensitive.

Libc seems to agree with this:

--- t.c ---
#include <locale.h>
#include <stdio.h>
#include <regex.h>

char errbuf[1024];

int main() {
   int r;
   regex_t re;
   regmatch_t m;

   setlocale(LC_COLLATE, "cs_CZ.ISO8859_2");

   r = regcomp(&re, "[a[=M=]z]", REG_BASIC);
   printf("regcomp=%d\n", r);

   r = regexec(&re, "m", 0, &m, 0);
   printf("regexec=%d\n", r);

   if (r != 0) {
     regerror(r, &re, errbuf, 1023);
     printf("error: %s\n", errbuf);

Please file a bug or submit a patch.


There are a few failures related to locales. All these tests "pass" (i.e. don't fail) on my Ubuntu, but that's likely because it doesn't have the extra locales installed.
I'll try to go the second route (i.e. patch), but I need to sift through the failures first.