title: "Narrowing conversion from 'int' to 'char' inside { }" for legal values when cross compiling
body: <p>I have a C++ project that I compile both using <code>g++</code> on my machine (compiling to "host") and to an ARM processor using a cross compiler (in my case <code>arm-cortex_a8-linux-gnueabi-g++</code>). I am in the process of converting to C++0x/11 standart and there is an error I get when compiling initialization list, which I was able to reproduce in the following snippet:</p>
  
  <pre><code>int main(void) {
      char c[1] = {-108};
  }
  </code></pre>
  
  <p>This program is seemingly correct as <code>-108</code> is a legal value for a <code>char</code>.
  Compiling this with <code>g++</code> yields no error with the following command line:</p>
  
  <pre><code>g++ example.cc -std=c++0x
  </code></pre>
  
  <p>However, when I compile with the cross-compiler, like so:</p>
  
  <pre><code>arm-cortex_a8-linux-gnueabi-g++ example.cc -std=c++0x
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>example.cc: In function 'int main()':
  example.cc:2:22: error: narrowing conversion of '-0x0000000000000006c' from 'int' to 'char' inside { } [-fpermissive]
  </code></pre>
  
  <p>Since the value is legal, this seems like a bug. Can you explain why I get this error and what to do to solve it?</p>
  
  <p><strong>Edit</strong>: note that using positive values (e.g., <code>108</code>) is legal and does not result in an error on both compilers.</p>