cplusplus / cplusplus/draft

Example "uninit" in [dcl.constexpr] no longer valid

Open
#5,718 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TeX
Stars
221
Forks
813
Avg merge
16h 4m
Merged PRs (30d)
36

Description

We discovered during the application of https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2022/p2448r2.html (which removes one incorrect example) that there is another incorrect example in dcl.constexpr, Example 2 in (3.4):

constexpr int uninit() {
  struct { int a; } s;
  return s.a;                   // error: uninitialized read of s.a
}

@zygoloid says, "Yeah, it's an uninitialized read, but prior to p2448r2 that was IFNDR and now it's simply valid."

Contributor guide

No contributing guide indexed for this repository

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

Locate [dcl.constexpr], Example 2 in the draft source and read the surrounding wording alongside P2448R2. Confirm how this example should be represented under the current rule, then build the draft or run its relevant validation to ensure the example and surrounding text are consistent.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.