[cfe-dev] Regex/locale libcxx test failure on FreeBSD
Eric Fiselier via cfe-dev
cfe-dev at lists.llvm.org
Sat Oct 15 13:38:44 PDT 2016
Please file a bug or submit a patch.
/Eric
On Fri, Oct 14, 2016 at 6:38 PM, Krzysztof Parzyszek via cfe-dev <
cfe-dev at lists.llvm.org> wrote:
> The test is
> projects/libcxx/test/std/re/re.alg/re.alg.match/basic.pass.cpp
>
> This assertion fails on FreeBSD:
>
> std::locale::global(std::locale(LOCALE_cs_CZ_ISO8859_2));
> {
> std::cmatch m;
> const char s[] = "m";
> assert(std::regex_match(s, m, std::regex("[a[=M=]z]",
> std::regex_constants::basic)));
>
>
> 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);
> }
> }
> -----------
>
> clang t.c
> ./a.out
>
> regcomp=0
> regexec=1
> error: regexec() failed to match
>
>
> If the string in t.c is "M", it matches.
>
> -Krzysztof
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20161015/60075095/attachment.html>
More information about the cfe-dev
mailing list