[Bug c++/59005] New: Having designated inits in C++ with -std=c++11 does not cause any errors

2013-11-05 Thread p.micolet at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59005

Bug ID: 59005
   Summary: Having designated inits in C++ with -std=c++11 does
not cause any errors
   Product: gcc
   Version: 4.7.0
Status: UNCONFIRMED
  Severity: normal
  Priority: P3
 Component: c++
  Assignee: unassigned at gcc dot gnu.org
  Reporter: p.micolet at gmail dot com

This piece of code:

#include 
using namespace std;

int main(int argc, char** argv)
{
int test[2][2] ={
[0]={1,2},
[1]={3,4},
};

for (int x = 0; x<2;x++)
{
for (int y = 0; y<2; y++)
{
cout << test[x][y] << endl;
}
}

return 0;
}

will compile and execute fine when running:

g++ -Wall -std=c++11 -pedantic test.cpp

No errors or warnings are shown, even if designated initializers are not
supported in the C++11 standard. 

Using: GCC 4.8.1
Target: x86_64-suse-linux
Flags: -Wall -std=c++11 -pedantic


[Bug c++/59005] Having designated inits in C++ with -std=c++11 does not cause any errors

2013-11-05 Thread p.micolet at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59005

--- Comment #1 from p.micolet at gmail dot com ---
Also saw this issue using GCC 4.7.0, same target, same flags and same code


[Bug c++/59005] Having designated inits in C++ with -std=c++11 does not cause any errors

2013-11-05 Thread p.micolet at gmail dot com
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59005

--- Comment #4 from p.micolet at gmail dot com ---
Hi Daniel, I think it's a gcc extension, but it's not part of the C++11
standard, so surely adding the -std=c++11 should cause this code to not compile
or am I misunderstanding something ?

Thanks