<div class="gmail_quote">On Thu, Jan 26, 2012 at 12:00 PM, Sebastian Redl <span dir="ltr"><<a href="mailto:sebastian.redl@getdesigned.at">sebastian.redl@getdesigned.at</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><br><div><div>On 18.01.2012, at 22:39, Richard Smith wrote:</div><br><blockquote type="cite"><div><div class="im">On Wed, January 18, 2012 01:31, Sebastian Redl wrote:<br><font color="#006312"><br>
</font><blockquote type="cite">"The lifetime of the array is the same as that of the initializer_list<br></blockquote><blockquote type="cite">object." So if a temporary is constructed, wouldn't the lifetime of the array<br>
</blockquote><blockquote type="cite">be that of the temporary?<br></blockquote><br></div>This is DR1290. If I understand correctly, the intent is that the lifetime of<br>the array acts like initializer_list is a reference type binding to the array<br>
(under the rules in 12.2/5).<br></div></blockquote></div><br><div>Doesn't help with the new-expression situation, though, since you can't new a reference, so there are no existing rules.</div></div></blockquote><div>
<br></div><div>That's not entirely true. Consider:</div><div><br></div><div>  struct S { const int &r; };</div><div>  S *p = new S { 0 }; // reference is bound to temporary which is destroyed at end of full-expression </div>
<div><br></div><div>One consequence of this is that "new auto { ... }" is essentially always a bug.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><div>By the way, this issue appears empty to me in the list, i.e. no discussion or even description, just a title.</div></div></blockquote></div><br><div>The WG21 internal version of this issue has some links to discussion on the core reflector, but there's sadly not much information there either, other than that initializer_list was supposed to have reference semantics.</div>
<div><br></div><div>- Richard</div>