title: Initializing an array of _C++_ objects with index designators
body: <p>I am trying to port some code to GCC, that compiles OK with the IAR compiler.  The code initialises an array of C++ objects (a struct with an array of chars).  I can get it to work with GCC in C, but not with C++.  Here is a simple example.</p>
  
  <pre><code>#include  &lt;stdio.h&gt;
  
  typedef struct
  {
   int lineID[10];
  } TMenu;
  
  static const TMenu t1[8] =
  {
      {{3}},
      {{4}},
      [6] = {{33, 22}},
      [8] = {{33, 22}},
      {{}},
      {{9,8,7,6,5,4,3,2,1}},
  };
  </code></pre>
  
  <p>NOTE: I also had to add extra curly brackets around the initializers, which IAR didn't complain about.</p>
  
  <p>It compiles fine with GCC, but when compiled with G++ I get the following errors.</p>
  
  <pre><code>x.c:12:6: error: expected identifier before numeric constant
  x.c: In lambda function:
  x.c:12:9: error: expected '{' before '=' token
  x.c: At global scope:
  x.c:12:20: error: no match for 'operator=' in '._2 = {{33, 22}}'
  x.c:13:6: error: expected identifier before numeric constant
  x.c: In lambda function:
  x.c:13:9: error: expected '{' before '=' token
  x.c: At global scope:
  x.c:13:20: error: no match for 'operator=' in '._3 = {{33, 22}}'
  </code></pre>