samedi 31 janvier 2015

Brace-initialization of an array of structs in c++11

Here is my code:



#include <string>

struct A
{
int a;
std::string sa;
};

int main()
{
A arr[3]{};
}


When I compile it with gcc 4.8.2 (on Ubuntu 14.04) with -std=gnu++11 option I get the following error:



example.cpp: In function ‘int main()’:
example.cpp:11:14: internal compiler error: in gimplify_init_constructor, at gimplify.c:4271
A arr[3]{};
^


Why does it throw an internal compiler error? Is it a compiler bug?


Aucun commentaire:

Enregistrer un commentaire