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

Ed Catmur <ed at catmur dot uk> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|INVALID                     |---

--- Comment #2 from Ed Catmur <ed at catmur dot uk> ---
Yes... but the initializer_list that the array backs is itself temporary; it
has lifetime only for the duration of the call to the copy constructor. 

From https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48562#c6 :

> I think that a warning against "({...})" would be useful too
>    // fine
>    initializer_list<int> a{1, 2, 3};
>    // this is bad
>    initializer_list<int> b({1, 2, 3});
> Second one is bad because it will destroy the array after initializing 'b', 
> and won't lengthen the lifetime (because it will use the copy/move
> constructor).

Reply via email to