LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 35967 - <regex> syntax_option_type is not a proper bitmask
Summary: <regex> syntax_option_type is not a proper bitmask
Status: RESOLVED FIXED
Alias: None
Product: libc++
Classification: Unclassified
Component: All Bugs (show other bugs)
Version: 6.0
Hardware: All Linux
: P normal
Assignee: Unassigned Clang Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-01-16 06:45 PST by Mikhail Maltsev
Modified: 2019-03-28 10:32 PDT (History)
3 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mikhail Maltsev 2018-01-16 06:45:58 PST
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.
Comment 1 hstong 2018-01-16 07:36:25 PST
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;
}
Comment 2 Marshall Clow (home) 2018-01-16 09:05:53 PST
We've got some ABI-breaking stuff coming for <regex>
When that happens, we'll circle back to this.
Comment 3 Marshall Clow (home) 2019-03-28 10:32:04 PDT
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.