220 30579 <d34038aa-e4d4-4795-997f-f9eef1b2cf1d@isocpp.org> article
Path: news.gmane.org!.POSTED!not-for-mail
From: "'Scott Dolim' via ISO C++ Standard - Future Proposals" <std-proposals@isocpp.org>
Newsgroups: gmane.comp.lang.c++.isocpp.proposals
Subject: Explicit temporary lifetime extension
Date: Sat, 14 Jan 2017 15:02:52 -0800 (PST)
Lines: 36
Approved: news@gmane.org
Message-ID: <d34038aa-e4d4-4795-997f-f9eef1b2cf1d@isocpp.org>
References: <dac89450-71b1-4bf4-85e0-a217f0e69944@isocpp.org>
Reply-To: std-proposals@isocpp.org
NNTP-Posting-Host: blaine.gmane.org
Mime-Version: 1.0
Content-Type: multipart/mixed; 
	boundary="----=_Part_3313_1952947547.1484434972365"
X-Trace: blaine.gmane.org 1484434976 21156 195.159.176.226 (14 Jan 2017 23:02:56 GMT)
X-Complaints-To: usenet@blaine.gmane.org
NNTP-Posting-Date: Sat, 14 Jan 2017 23:02:56 +0000 (UTC)
To: ISO C++ Standard - Future Proposals <std-proposals@isocpp.org>
Original-X-From: std-proposals+bncBC27BZU67ADBBHO45LBQKGQEARVHPVY@isocpp.org Sun Jan 15 00:02:51 2017
Return-path: <std-proposals+bncBC27BZU67ADBBHO45LBQKGQEARVHPVY@isocpp.org>
Envelope-to: gclcip-std-proposals@m.gmane.org
Original-Received: from mail-pf0-f199.google.com ([209.85.192.199])
	by blaine.gmane.org with esmtp (Exim 4.84_2)
	(envelope-from <std-proposals+bncBC27BZU67ADBBHO45LBQKGQEARVHPVY@isocpp.org>)
	id 1cSXLV-0004nJ-6U
	for gclcip-std-proposals@m.gmane.org; Sun, 15 Jan 2017 00:02:49 +0100
Original-Received: by mail-pf0-f199.google.com with SMTP id 201sf36555329pfw.5
        for <gclcip-std-proposals@m.gmane.org>; Sat, 14 Jan 2017 15:02:54 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=isocpp-org.20150623.gappssmtp.com; s=20150623;
        h=date:from:to:message-id:in-reply-to:references:subject:mime-version
         :x-original-sender:reply-to:precedence:mailing-list:list-id
         :x-spam-checked-in-group:list-post:list-help:list-archive
         :list-subscribe:list-unsubscribe;
        bh=ntdxu7/bNPO/NCwmqKVakW98V+0JsZm3nkQHYFas3/4=;
        b=eH6iCIwKulucxKx2qMTe2ZxYug0UCeyBgfUdaYVBv2F+J+eYFcssFWwfjLjDRS/ddX
         gEoUu2ieKIzKHGkyPVxztnAtOkz4OHSUofRuLLenH4t2n4noN6WGcKS6lJ5ReOL3/H/B
         vEf+zxjEqjhCuR45+QDadwDHxOvJ9+ReFulbPnHE9NXsKqD5H2rE0hSMztr1W/wsCgBG
         5RDHYq4tH4lVYphbZUiinAD/TRsj65L2/60HJzJuhawdMHSF2u/YG5hf5lB+y+65K3tO
         8P4SRVYv8ecs7LDoEnrHCOEw5Oq/p6Xn1vjkLAXUEft9aCcMfDhHgGCV1jam04qd4aEb
         qrSQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20161025;
        h=x-gm-message-state:date:from:to:message-id:in-reply-to:references
         :subject:mime-version:x-original-sender:reply-to:precedence
         :mailing-list:list-id:x-spam-checked-in-group:list-post:list-help
         :list-archive:list-subscribe:list-unsubscribe;
        bh=ntdxu7/bNPO/NCwmqKVakW98V+0JsZm3nkQHYFas3/4=;
        b=VvUKSFqE2lqbvdyO2dDP/t6o/3ypZQ2p3W6eq6Y8zDzyUtp5difvKuFxPSjoQ0Bnul
         hkBM2GynI8m/vunlGHcI1D5OlibsNx/XD3PIbiLDxfm40UwfUEKL+qsq+4jMkCf5NEJr
         h56JsjctCvVOsWzC0ZAiEUK5CmSFin50ChQ3hqj+17Ly8Xy9TEZlgbwzGcZU/bGVnIwL
         HbcDLtc7HzjgyA5+AqryWZy7ov/gi6bsDY6I3Mp9zmYO4jt8yNGX8zNhfgFtZGpIRRie
         p9pwe5VMpe0CNS1THe5ZNYd6jr7LBhnw1ZafDuVcAUQr2vMJh0R1xOFixae8+O+vPT6u
         tYeQ==
X-Gm-Message-State: AIkVDXJSIYg8lVis0iGNnA7s/I+GHjZxbs/kxtF2pd7D5of8iuNS5VmUkw2vQ3IBP6E8HQ==
X-Received: by 10.99.112.84 with SMTP id a20mr9238788pgn.168.1484434973569;
        Sat, 14 Jan 2017 15:02:53 -0800 (PST)
X-BeenThere: std-proposals@isocpp.org
Original-Received: by 10.157.8.69 with SMTP id 63ls12237021oty.30.gmail; Sat, 14 Jan
 2017 15:02:52 -0800 (PST)
X-Received: by 10.157.14.183 with SMTP id 52mr2330889otj.20.1484434972930;
        Sat, 14 Jan 2017 15:02:52 -0800 (PST)
In-Reply-To: <dac89450-71b1-4bf4-85e0-a217f0e69944@isocpp.org>
X-Original-Sender: sdolim@yahoo.com
X-Original-From: Scott Dolim <sdolim@yahoo.com>
Precedence: list
Mailing-list: list std-proposals@isocpp.org; contact std-proposals+owners@isocpp.org
List-ID: <std-proposals.isocpp.org>
X-Google-Group-Id: 399137483710
List-Post: <https://groups.google.com/a/isocpp.org/group/std-proposals/post>, <mailto:std-proposals@isocpp.org>
List-Help: <https://support.google.com/a/isocpp.org/bin/topic.py?topic=25838>, <mailto:std-proposals+help@isocpp.org>
List-Archive: <https://groups.google.com/a/isocpp.org/group/std-proposals/>
List-Subscribe: <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>,
 <mailto:std-proposals+subscribe@isocpp.org>
List-Unsubscribe: <mailto:googlegroups-manage+399137483710+unsubscribe@googlegroups.com>,
 <https://groups.google.com/a/isocpp.org/group/std-proposals/subscribe>
Xref: news.gmane.org gmane.comp.lang.c++.isocpp.proposals:30579
Archived-At: <http://permalink.gmane.org/gmane.comp.lang.c++.isocpp.proposals/30579>

------=_Part_3313_1952947547.1484434972365
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

I think it is worth putting a stake in the ground and *defining* the term "=
lifetime extension" as the act of converting a temporary's value category t=
o lvalue.  Since temporary variables are introduced by the compiler to hold=
 transient intermediate values of a complex expression, those variables are=
 xvalues already (materialized from prvalue, by necessity).  Normally the t=
ransient value is meant to be immediately consumed by the operator of the t=
erm it appears in.  As I recall, lifetime extension was added to C++ in ord=
er to handle cases the operator binds to the address of the temporary inste=
ad, so a dangling reference would result if it actually did expire immediat=
ely.  The core idea being to delay the expiration past the point where any =
other part of the overall expression could witness it (which would mean see=
ing the temporary as an xvalue) so, as with the case of named rvalue refere=
nce variables, this therefore categorizes them as lvalue, for the duration =
the expression evaluation (or longer). =20

Basically, exactly what you said with the "auto&& unnamed" example, but fli=
pping the logic so that the definition "lifetime extension =3D temporary is=
 now an lvalue" is the axiom which implies the example as an exposition of =
how the mechanism is implemented.

--=20
You received this message because you are subscribed to the Google Groups "=
ISO C++ Standard - Future Proposals" group.
To unsubscribe from this group and stop receiving emails from it, send an e=
mail to std-proposals+unsubscribe@isocpp.org.
To post to this group, send email to std-proposals@isocpp.org.
To view this discussion on the web visit https://groups.google.com/a/isocpp=
..org/d/msgid/std-proposals/d34038aa-e4d4-4795-997f-f9eef1b2cf1d%40isocpp.or=
g.

------=_Part_3313_1952947547.1484434972365--

.
