The following is a stripped-down version of the problem:
#include <initializer_list>
#include <iostream>
enum objects { zero, one, two, three, four, five, six, seven };
std::initializer_list<objects> objects_list()
{
return { zero, one, two, three, four, five, six, seven };
}
int main()
{
for (auto a : objects_list())
{
std::cout << a << ' ';
}
std::cout << '\n';
}
My expectation is that the programs outputs:
0 1 2 3 4 5 6 7
which is comfirmed by GCC 4.9.2, but a GCC fresh from its git repository yields:
0 0 -85997960 32712 -1076836160 32765 0 32
which seem basically random numbers.
Is there a problem with my program or with GCC?
Aucun commentaire:
Enregistrer un commentaire