Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ 11 Dynamic Array Partial List Initialization (Bug or Misunderstanding)?

Tags:

I have the following C++ 11 code:

int *ipa = new int[5]{1, 2, 3};

I thought I understood that elements 3 and 4 were supposed to be value (0 in this case) initialized. In Visual C++ 2013, that is happening. In Mingw 4.8.1 it is not; they are being default initialized (that is, uninitialized).

My question is, is this a known compiler (GCC or MingW) bug? I've searched through all the bug lists (and Googled) in vain. Or, have I somehow misunderstood what is supposed to happen?