Bug 233994

Summary: boost::regex match but not std::regex
Product: Base System Reporter: georg-bsd
Component: binAssignee: freebsd-bugs (Nobody) <bugs>
Status: New ---    
Severity: Affects Only Me CC: cem
Priority: ---    
Version: 11.2-RELEASE   
Hardware: amd64   
OS: Any   
Attachments:
Description Flags
Testcase
none
Simplified testcase none

Description georg-bsd 2018-12-13 21:18:28 UTC
Created attachment 200092 [details]
Testcase

I got the attached program. It has a global locale set (de_DE.UTF-8).

Under Windows and Linux the regexes match. Under FreeBSD and clang the regex doesnt match. It seems related to the set locale. If i switch to boost::regex, my application works.
Comment 1 georg-bsd 2018-12-13 21:21:11 UTC
Expected output: "All ok"

Got Output: "Bug triggered"
Comment 2 Conrad Meyer freebsd_committer freebsd_triage 2018-12-13 23:57:16 UTC
What makes you believe this is a locale or even libc++ problem?  I don't see how any of the regular expressions are even locale dependent.

I also cannot reproduce the problem without boost, neither on CURRENT nor 11.  (I.e., using 'std::locale::global(std::locale("de_DE.UTF-8"));' to override the user's locale instead of the boost goop.)

I don't have boost installed, so I can't explore that avenue, but I am having trouble even understanding how this program would fail.
Comment 3 georg-bsd 2018-12-14 10:43:11 UTC
I think it might be a bug in libc++ because 
on Windows(MSVC 2013 & MSVC 2017) and on Linux (gcc 8.2 + libstdc++) this regex (from std) matches with the global locale from boost. Also the regex from boost matches (replace std::regex by boost::regex). 

Do you think the other implementations are wrong? 

This bug triggers only (also on my box and only on freebsd with clang and libc++) when i use boost::locale. As you said, with std::locale() it matches.

When i comment the locale out, and use the std locale, the regex matches.
Comment 4 georg-bsd 2018-12-14 10:44:46 UTC
I also don't understand why this regex is locale dependent and why it fails with the locale set from boost::locale.
Comment 5 Conrad Meyer freebsd_committer freebsd_triage 2018-12-14 10:56:21 UTC
Seems like it might be a Boost bug to me.
Comment 6 georg-bsd 2018-12-17 14:54:17 UTC
Created attachment 200200 [details]
Simplified testcase

Reduced testcase
Comment 7 georg-bsd 2018-12-17 15:02:45 UTC
For reference: Boost::locale issue
https://github.com/boostorg/locale/issues/35

(I am waiting for a new account on llvm bug tracker).
Comment 8 georg-bsd 2018-12-17 15:30:23 UTC
Bug on LLVM Bugtracker:
https://bugs.llvm.org/show_bug.cgi?id=40052