<regex> syntax_option_type is not a proper bitmask
| Bugzilla Link | 35967 |
| Resolution | FIXED |
| Resolved on | Mar 28, 2019 10:32 |
| Version | 6.0 |
| OS | Linux |
| CC | @hubert-reinterpretcast,@mclow |
Extended Description
According to [re.synopt]: "The type syntax_option_type is an implementation-defined bitmask type"
[bitmask.types] defines some requirements for such types, specifically: "Here, the names C0, C1, etc. represent bitmask elements for this particular bitmask type. All such elements have distinct, nonzero values"
Contrarily to this requirement, in libc++ std::regex_constants::ECMAScript is 0.
Fixed in commit 357190. Note that this requires a new dylib. (and is an ABI break, so it's off by default)
Also, I looked at 'format_default' and 'match_default', but they're defined as empty bitmasks, so they stayed == 0.
We've got some ABI-breaking stuff coming for <regex>
When that happens, we'll circle back to this.
As mentioned in http://lists.llvm.org/pipermail/cfe-dev/2016-October/051290.html, the use of "0" breaks use cases like the following: bool isEcmaScript(::std::regex_constants::syntax_option_type v) { return v & ::std::regex_constants::ECMAScript; }