http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49122



--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-08 
12:39:26 UTC ---

(In reply to comment #5)

> Hi Jonathan Wakely,

> 

> Just wanted to confirm the doubt:



That's not a "doubt" it's a question.



> Do you wanted to mean that, the initializer_list<T> behaviour is exactly like

> this(work for local stack members) and there nothing work around possible to

> avoid this observation ?



Yes. If you want to pass data out of a function use a container or a tuple or

something that *copies* the data. An std::initializer_list is not a container,

it does not own or copy its elements.



The workaround is don't misuse initializer_list for something it isn't designed

to do.

Reply via email to