This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49122] [C++0x] initializer_list is broken


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]