[Bug c++/54293] When a reference is bound to subobject of a temporary, lifetime of the temporary is not extended
jpalecek at web dot de
gcc-bugzilla@gcc.gnu.org
Mon Aug 20 22:52:00 GMT 2012
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54293
--- Comment #8 from Jiří Paleček <jpalecek at web dot de> 2012-08-20 22:52:31 UTC ---
(In reply to comment #7)
> (In reply to comment #6)
> > — If E2 is a non-static data member and the type of E1 is “cq1 vq1 X”, and the
> > type of E2 is “cq2 vq2
> > T”, the expression designates the named member of the object designated by the
> > first expression. If
> > E1 is an lvalue, then E1.E2 is an lvalue; if E1 is an xvalue, then E1.E2 is an
> > xvalue; otherwise, it is a
> > prvalue. [ IMHO it misses the case when T is a reference type, but that doesn't
> > apply here ]
>
> Did you mean E2 instead of T here? In this case this is described in the
> beginning of 5.2.5 p4:
>
> "If E2 is declared to have type “reference to T,” then E1.E2 is an lvalue; the
> type of E1.E2 is T."
You're right, my bad. I thought it MUST be there but missed that - anyway, it
is not relevant here.
> I agree with your analysis, but would like to point out that there is change
> planned to essentially this part of the wording due to
>
> http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#616
>
> Assuming it becomes accepted E1.E2 will become an xvalue in this case (SE
> bullet 2 of the P/R)
Thanks for the info, it is interesting (although I can't see the relevance of
this particular change to the issues it should solve, which are basically about
using uninitialized objects).
More information about the Gcc-bugs
mailing list