`<regex>`: `regex_traits<_Elem>` uses an inadmissible value of type `char_class_type` to represent character class "w"
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 11.1k
- Forks
- 1.7k
- Avg merge
- 4d 15h
- Merged PRs (30d)
- 22
Description
regex_traits<_Elem> uses static_cast<ctype_base::mask>(-1) to represent the character class "w":
https://github.com/microsoft/STL/blob/8124540f8bce3faad76a6dddd050f9a69af4b87d/stl/inc/regex#L354
This is an inadmissible choice, because it violates [re.grammar]/9:
The results from multiple calls to
traits_inst.lookup_classnamecan be bitwise or'ed together and subsequently passed totraits_inst.isctype.
Specifically, or'ing the char_class_type for "w" with the char_class_type for any other character class always produces the value for "w" again, even if the combination should match more characters.
Additional remarks
I think resolving this issue will break ABI. However, it should be possible to mitigate the problems caused by this issue.
vNext note: Resolving this issue will require breaking binary compatibility. We won't be able to accept pull requests for this issue until the vNext branch is available. See #169 for more information.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with stl/inc/regex around the referenced regex_traits<_Elem> implementation and read [re.grammar]/9. Determine how character-class values should combine without violating the ABI, with the vNext branch and #169 as context; done means combined class lookups produce the required matches and compatibility concerns are addressed.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100