<div class="gmail_quote">On Tue, Jul 24, 2012 at 3:19 AM, Vinxxe <span dir="ltr"><<a href="mailto:vinxxe@gmail.com" target="_blank">vinxxe@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
is it possible, with some compiler option, to compile the following<br>
code with clang?<br>
//------------------------------------<br>
int main(){<br>
<br>
  int x[10];<br>
<br>
  x={1,2,3,4,5,6,7,8,9,0};<br>
<br>
}<br>
//-------------------------------------<br></blockquote><div><br></div><div>If you're prepared to change the code, this is valid* C++11:</div><div><br></div><div>int main() {</div><div>  struct { int x[10]; } s;</div>
<div>  s = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };</div><div>}</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I tried this<br>
<br>
clang -c main.cc -std=gnu++11<br>
<br>
and got the following error:<br>
<br>
main.cc:5:4: error: array type 'int [10]' is not assignable<br>
  x={1,2,3,4,5,6,7,8,9,0};<br></blockquote><div><br></div><div>You'll also need a newer Clang.</div><div><br></div><div>[*] According to a current discussion on CWG, and according to Clang and GCC. Not according to the standard.</div>
</div>