[Bug c++/49122] New: [C++0x] initializer_list is broken
sscrisk at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon May 23 13:14:00 GMT 2011
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)
More information about the Gcc-bugs
mailing list