microsoft / microsoft/STL

`<regex>`: Constants in `std​::​regex_constants` are not `constexpr` variables

Open
#4,100 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug regex
Dominant language
C++
Stars
11.1k
Forks
1.7k
Avg merge
4d 15h
Merged PRs (30d)
22

Description

Describe the bug

The Standard specified that constants in std::regex_constants to be constexpr variables ([re.const]).

However, MSVC STL just implements them as enumerators of unscoped enumerations, which are not variables.

It seems that they have never been specified be to non-object. In TR1 (WG21-N1836) they were static const variables.

Command-line test case

Godbolt link

Additional context

libc++ is similarly buggy (llvm/llvm-project#69420).

Also tracked by VSO-498998 / AB#498998 .

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the std::regex_constants entry point and compare the MSVC STL implementation with the linked Standard specification. Use the provided Godbolt test case to inspect the current declarations and verify that the affected constants are represented as constexpr variables when the fix is complete.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.