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.ref]/5 CWG 453: What is a valid object? function? #2304

Open
languagelawyer opened this issue Aug 23, 2018 · 1 comment
Open

[dcl.ref]/5 CWG 453: What is a valid object? function? #2304

languagelawyer opened this issue Aug 23, 2018 · 1 comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.

Comments

@languagelawyer
Copy link
Contributor

languagelawyer commented Aug 23, 2018

[dcl.ref]/5:

A reference shall be initialized to refer to a valid object or function.

Is it an object within its lifetime? Or an object containing a valid value? In a valid state?

[basic.life] says that binding a reference to a virtual base class to a glvalue denoting an object not within its lifetime results in UB. If assume that the list of UBs from using a glvalue denoting an object outside its lifetime is complete, then the conclusion that binding the glvalue to another kind of a reference does not result in UB will follow. And we should conclude that "valid" is not about the lifetime.

Also, according to the style guidelines, "shall" shall be used to put a requirement on a well-formed program. This rule is unlikely to be a diagnosable rule.

@jensmaurer
Copy link
Member

This is CWG 453.

@jensmaurer jensmaurer added cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking. labels Sep 4, 2018
@jensmaurer jensmaurer changed the title [dcl.ref]/5: what is a valid object? function? [dcl.ref]/5 CWG 453: What is a valid object? function? Sep 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cwg Issue must be reviewed by CWG. not-editorial Issue is not deemed editorial; the editorial issue is kept open for tracking.
Projects
None yet
Development

No branches or pull requests

2 participants