llvm-project icon indicating copy to clipboard operation
llvm-project copied to clipboard

<regex> syntax_option_type is not a proper bitmask

Open miyuki opened this issue 8 years ago • 3 comments

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.

miyuki avatar Jan 16 '18 14:01 miyuki

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.

mclow avatar Mar 28 '19 17:03 mclow

We've got some ABI-breaking stuff coming for <regex> When that happens, we'll circle back to this.

mclow avatar Jan 16 '18 17:01 mclow

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; }

hubert-reinterpretcast avatar Jan 16 '18 15:01 hubert-reinterpretcast