-
Notifications
You must be signed in to change notification settings - Fork 41
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
BindReference in translation semantics #2 #522
Conversation
I can reproduce it localy (using
This happens because of these rules in dynamic.k:
Most likely, we need these rules, because
But why we need that rule? |
I still have problems binding a reference to temporary. The only support for temporaries is here in execution semantics -- The standard says:
Multiple cases may happen:
Currently, One option would be
which would keep the temporary object uninitialized.
which uses Also, this is an interesting corner case for binding reference to a temporary:
Also, I heard that C++17 changed some rules about temporaries to support guaranteed copy elision - does that affect reference binding? |
To create a temporary, One option is to add a new parameter to Another option is to add a new cell containing the duration of the object being created. Example: struct S { int const &r; };
S s1[2] {3,4};
int main()
{
S s2{4};
} |
(A fix of the error detected in the previous commit.)
Track duration of references. The temporary to which the reference is bound persists for the lifetime of the reference.
7ba7bf3
to
cc4dca4
Compare
No description provided.