cplusplus / cplusplus/draft

[dcl.init.list p3.10 The prvalue mentioned in the initialization of the reference abruptly appears without any specification

Open
#5,462 0 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

[dcl.init.list p3.10 says

Otherwise, if T is a reference type, a prvalue is generated. The prvalue initializes its result object by copy-list-initialization. The prvalue is then used to direct-initialize the reference.

The rule only says two things:

  1. Generate a prvalue.
  2. The effect of the prvalue(how it initializes the result object).

We didn't tell the story about how the prvalue was generated/ formed. Moreover, there is a case that the prvalue cannot be formed at all. It ought to be that we should associate the prvalue with the rules regarding copy-list-initialization. The suggestion might be:

Otherwise, if T is a reference type, an invented declaration U x = H; is introduced, where U is the referenced type and H is the initializer list; the program is ill-formed if the copy-list-initialization is ill-formed. The invented variable x is a prvalue. x is then used to direct-initialize the reference.

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

Start with [dcl.init.list] paragraph 3.10 and read the referenced copy-list-initialization rules. Done means the standard wording explains how the prvalue is formed and covers the case where that initialization is ill-formed, without leaving the proposed semantics implicit.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.