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] References are bound to objects and functions, not expressions #2855

Open
sdkrystian opened this issue Apr 30, 2019 · 4 comments · May be fixed by #2856
Open

[dcl.init.ref] References are bound to objects and functions, not expressions #2855

sdkrystian opened this issue Apr 30, 2019 · 4 comments · May be fixed by #2856
Assignees

Comments

@sdkrystian
Copy link
Contributor

sdkrystian commented Apr 30, 2019

There are several occurrences in the wording saying that references are bound to expressions, which is incorrect:

[dcl.init.ref]/5.1 sentence 1

[...] the reference is bound to the initializer expression lvalue in the first case and to the lvalue result of the conversion in the second case

[dcl.init.ref]/5.3 sentence 3

[...] the reference is bound to the resulting glvalue

[dcl.init.ref]/5.4.2

The temporary materialization conversion is applied and the reference is bound to the result

Obviously, the reference should be bound to the object or function that the expression refers to, so this wording is technically incorrect.

Proposed fix

In each case where a reference is said to bind to an expression, it will be replaced with "the object or reference to which the initializer refers", or a variant thereof.

@sdkrystian sdkrystian changed the title [dcl.init.ref] References are bound to entities, not expressions [dcl.init.ref] References are bound to objects and functions, not expressions Apr 30, 2019
@cpplearner
Copy link
Contributor

I don't think the standard has a definition for "bound to". I usually understand it as a synonym of "initialized with".

@sdkrystian
Copy link
Contributor Author

@cpplearner I understand it as "set to refer to". The standard does use it all over the place when referring to references, so it may be useful to define it.

@sdkrystian
Copy link
Contributor Author

@cpplearner Here's some wording to clarify for what bound means, perhaps @zygoloid could look at it to verify that its good.

A reference is said to be bound to an object or function E when it is initialized to refer to E.

@RealLitb
Copy link

RealLitb commented Jul 28, 2019

I think if this is changed as proposed, the definition of "binds directly" should also be changed to be in terms of objects and functions. Just so that if "binds directly to X" is true, then "binds to X" is true aswell.

EDIT: to clarify - we say "the argument expression binds directly" in ranking certain overload resolution scenarios. I don't propose changing any text, just pointing out this.

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

Successfully merging a pull request may close this issue.

3 participants