public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/49122] New: [C++0x] initializer_list is broken
@ 2011-05-23 13:14 sscrisk at gmail dot com
  2011-05-23 14:52 ` [Bug c++/49122] " paolo.carlini at oracle dot com
                   ` (7 more replies)
  0 siblings, 8 replies; 9+ messages in thread
From: sscrisk at gmail dot com @ 2011-05-23 13:14 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: [C++0x] initializer_list is broken
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: sscrisk@gmail.com


The initializer_list object returned to function is broken.
See the next code:

#include<initializer_list>
#include<iostream>

std::initializer_list<int> f(int a, int b)
{
 return {a, b};
}

int main()
{
 std::initializer_list<int> list = f(0, 1);
 for(int i: list)
  std::cout << i << std::endl;
}


Output result (example) is

2293416
2293636


It's a strange result.
Output should be

0
1


I tried use compiler version 4.6.0 Release and 4.7.0 20110521 (experimental)


^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2013-03-08  7:57 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-05-23 13:14 [Bug c++/49122] New: [C++0x] initializer_list is broken sscrisk at gmail dot com
2011-05-23 14:52 ` [Bug c++/49122] " paolo.carlini at oracle dot com
2011-05-23 17:10 ` redi at gcc dot gnu.org
2013-01-08  9:39 ` joy.career at gmail dot com
2013-01-08 10:28 ` redi at gcc dot gnu.org
2013-01-08 10:48 ` joy.career at gmail dot com
2013-01-08 12:39 ` redi at gcc dot gnu.org
2013-03-08  6:56 ` potswa at mac dot com
2013-03-08  7:57 ` potswa at mac dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).