Skip to content

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

Open
@tkoeppe

Description

@tkoeppe

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."

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions