From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2474 invoked by alias); 20 Aug 2012 22:52:46 -0000 Received: (qmail 2464 invoked by uid 22791); 20 Aug 2012 22:52:45 -0000 X-SWARE-Spam-Status: No, hits=-4.3 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00,KHOP_THREADED X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 20 Aug 2012 22:52:32 +0000 From: "jpalecek at web dot de" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/54293] When a reference is bound to subobject of a temporary, lifetime of the temporary is not extended Date: Mon, 20 Aug 2012 22:52:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: jpalecek at web dot de X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-08/txt/msg01412.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D54293 --- Comment #8 from Ji=C5=99=C3=AD Pale=C4=8Dek 20= 12-08-20 22:52:31 UTC --- (In reply to comment #7) > (In reply to comment #6) > > =E2=80=94 If E2 is a non-static data member and the type of E1 is =E2= =80=9Ccq1 vq1 X=E2=80=9D, and the > > type of E2 is =E2=80=9Ccq2 vq2 > > T=E2=80=9D, the expression designates the named member of the object de= signated by the > > first expression. If > > E1 is an lvalue, then E1.E2 is an lvalue; if E1 is an xvalue, then E1.E= 2 is an > > xvalue; otherwise, it is a > > prvalue. [ IMHO=C2=A0it misses the case when T is a reference type, but= that doesn't > > apply here ] >=20 > Did you mean E2 instead of T here? In this case this is described in the > beginning of 5.2.5 p4: >=20 > "If E2 is declared to have type =E2=80=9Creference to T,=E2=80=9D 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 cha= nge > planned to essentially this part of the wording due to=20 >=20 > http://www.open-std.org/jtc1/sc22/wg21/docs/cwg_active.html#616 >=20 > 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 a= bout using uninitialized objects).