Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xmh0511 opened this issue May 11, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented May 11, 2022

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

@xmh0511 xmh0511 changed the title [dcl.init.list p3.10 The prvalue abruptly in the initialization of the reference appears without any specification [dcl.init.list p3.10 The prvalue mentioned in the initialization of the reference abruptly appears without any specification May 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant