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.ref] p5.4.1 "the result of the call" is not an expression to which type check can be done #5511

Open
xmh0511 opened this issue Jun 7, 2022 · 0 comments

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jun 7, 2022

[dcl.init.ref] p5.4.1 says

The result of the call to the conversion function, as described for the non-reference copy-initialization, is then used to direct-initialize the reference.

This rule in introduced by CWG1571. The intent is that check the cv-qualification between the referenced type of the reference that is being initialized and the return type of the function call. However, a function call is either a glvalue or prvalue, the result of which is either an entity(i.e. an object or a function) or a value, which is not what we expect for checking whether discarding the cv-qualification. Moreover, the initializer expression used to initialize a reference is first to be an expression.

Another issue is that "the call to the conversion function" sounds like the selected function can only be the conversion function; a constructor is not a conversion function.

So, in order to clarify such two issues, [dcl.init.ref] p5.4.1 might be changed to

The call to the selected function, as described for the non-reference copy-initialization, is then used to direct-initialize the reference.

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