microsoft / microsoft/STL

Use `if consteval` after compiler support arrives

Open
#5,225 9 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

https://en.cppreference.com/w/cpp/23 indicates that Clang 14 began supporting C++23 WG21-P1938R3 if consteval, and it's available as Future Technology in C++20 mode: https://godbolt.org/z/MhjoaxW6a

For C1XX, MSVC-PR-598052 was merged on 2024-12-12 and will ship in VS 2022 17.14 Preview 1. It was implemented as Future Technology that we can access with a suppressible warning (C5282). Presumably this also goes back to C++20 but not earlier (haven't checked) as consteval became a keyword in C++20.

For EDG in VS 2022 17.13 Preview 2, if consteval appears to be supported in C++23 mode, but C++20 mode emits a syntax error. (As EDG isn't a codegen compiler for us, this is the least important.)

I haven't checked CUDA.

While I'm not looking forward to macroization, we should look into using if consteval after C1XX support ships, because it can significantly improve debug codegen, and should give the release optimizer slightly less work to do.

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

No files, tests, or entry points are named. Start by verifying C++23 and C++20 support across Clang, C1XX, EDG, and CUDA, then locate the debug code-generation paths that could use if consteval. Done means adopting the construct where supported while preserving compatibility and validating the affected compiler configurations.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
compilers
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.