title: gcc 4.8.1: combining c code with c++11 code
body: <p>I have not made ​​much effort to discover the cause, but gcc 4.8.1 is giving me a lot of trouble to compile old sources that combine c and c++ plus some new stuff in c++11</p>
  
  <p>I've managed to isolate the problem in this piece of code:</p>
  
  <pre><code># include &lt;argp.h&gt;
  # include &lt;algorithm&gt;
  </code></pre>
  
  <p>which compiles fine with <code>g++ -std=c++0x -c -o test-temp.o test-temp.C</code> version 4.6.3, ubuntu 12.04</p>
  
  <p>By contrast, with version 4.8.1, the same command line throws a lot of errors:</p>
  
  <pre><code>In file included from /home/lrleon/GCC/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include/x86intrin.h:30:0,
                   from /home/lrleon/GCC/include/c++/4.8.1/bits/opt_random.h:33,
                   from /home/lrleon/GCC/include/c++/4.8.1/random:51,
                   from /home/lrleon/GCC/include/c++/4.8.1/bits/stl_algo.h:65,
                   from /home/lrleon/GCC/include/c++/4.8.1/algorithm:62,
                   from test-temp.C:4:
  /home/lrleon/GCC/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include/mmintrin.h: In function ‘__m64 _mm_cvtsi32_si64(int)’:
  /home/lrleon/GCC/lib/gcc/x86_64-unknown-linux-gnu/4.8.1/include/mmintrin.h:61:54: error: can’t convert between vector values of different size
     return (__m64) __builtin_ia32_vec_init_v2si (__i, 0);
                                                        ^
  </code></pre>
  
  <p>... and much more.</p>
  
  <p>The same happens if I execute</p>
  
  <p><code>g++ -std=c++11 -c -o test-temp.o test-temp.C</code> ; again, version 4.8.1</p>
  
  <p>But, if I swap the header lines, that is</p>
  
  <pre><code># include &lt;algorithm&gt;
  # include &lt;argp.h&gt;
  </code></pre>
  
  <p>then all compiles fine.</p>
  
  <p>Someone enlighten me to understand what is happening?</p>