title: Excess elements in scalar initializer code compiles with gcc but not g++
body: <p>Just curious why this code (that it is obviously wrong) using gcc it compiles, however the same code using the g++ it does not.</p>
  <pre><code>int main()
  {
      char *foo = {&quot;bar&quot;, &quot;fred&quot;, &quot;bob&quot;};
  
      return 0;
  }
  </code></pre>
  <p>gcc gives this warning but still compiles and generates the binary:</p>
  <blockquote>
  <p>% <strong>gcc -o x x.c</strong></p>
  <p>x.c: In function ‘main’: x.c:3:5: warning: excess
  elements in scalar initializer [enabled by default] x.c:3:5: warning:
  (near initialization for ‘foo’) [enabled by default] x.c:3:5: warning:
  excess elements in scalar initializer [enabled by default] x.c:3:5:
  warning: (near initialization for ‘foo’) [enabled by default]</p>
  <p>% <strong>ls -l x</strong></p>
  <p>-rwxr-xr-x 1 overdrive overdrive 6593 Jul 28 21:51 x</p>
  </blockquote>
  <p>g++ gives this error and no any binary as an output:</p>
  <blockquote>
  <p>% <strong>g++ -o y y.cpp</strong></p>
  <p>y.cpp: In function ‘int main()’:
  y.cpp:3:38: error: scalar object ‘foo’ requires one element in initializer</p>
  <p>% <strong>ls -l y</strong></p>
  <p>ls: cannot access y: No such file or directory</p>
  </blockquote>
  <p>gcc and g++ version I am using is:</p>
  <blockquote>
  <p>% <strong>g++ --version</strong><br />
  g++ (Debian 4.7.2-5) 4.7.2
  Copyright (C) 2012 Free Software Foundation, Inc.
  This is free software; see the source for copying conditions.  There is NO
  warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.</p>
  </blockquote>
  <p>Is there any good reason why this compiles in gcc and not in g++? or it is clearly a bug?</p>