From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1767 invoked by alias); 8 Jan 2013 12:39:52 -0000 Received: (qmail 32471 invoked by uid 48); 8 Jan 2013 12:39:30 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/49122] [C++0x] initializer_list is broken Date: Tue, 08 Jan 2013 12:39:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2013-01/txt/msg00642.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49122 --- Comment #6 from Jonathan Wakely 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 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.