[Bug c++/66476] Erroneous initializer_list lifetime extension from temporary initializer_list

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed May 23 03:01:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66476

Jason Merrill <jason at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |jason at gcc dot gnu.org
         Resolution|---                         |INVALID

--- Comment #1 from Jason Merrill <jason at gcc dot gnu.org> ---
11.6.4 [dcl.init.list] paragraph 6:

The array has the same lifetime as any other temporary object (15.2), except
that initializing an initializer_list object from the array extends the
lifetime of the array exactly like binding a reference to a temporary.

So the array shares the lifetime of the initializer_list.


More information about the Gcc-bugs mailing list