title: Different compiler behavior with C++11
body: <p>The following code</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;complex&gt;
  #include &lt;algorithm&gt;
  
  template&lt;class K&gt;
  inline void conjVec(int m, K* const in) {
      static_assert(std::is_same&lt;K, double&gt;::value || std::is_same&lt;K, std::complex&lt;double&gt;&gt;::value, "");
      if(!std::is_same&lt;typename std::remove_pointer&lt;K&gt;::type, double&gt;::value)
  #ifndef OK
          std::for_each(in, in + m, [](K&amp; z) { z = std::conj(z); });
  #else
          std::for_each(reinterpret_cast&lt;std::complex&lt;double&gt;*&gt;(in), reinterpret_cast&lt;std::complex&lt;double&gt;*&gt;(in) + m, [](std::complex&lt;double&gt;&amp; z) { z = std::conj(z); });
  #endif
  }
  
  int main(int argc, char* argv[]) {
      std::vector&lt;double&gt; nums;
      nums.emplace_back(1.0);
      conjVec(nums.size(), nums.data());
      return 0;
  }
  </code></pre>
  
  <p>compiles fine on Linux with</p>
  
  <ol>
  <li>Debian clang version 3.5.0-9</li>
  <li>gcc version 4.9.1</li>
  <li>icpc version 15.0.1</li>
  </ol>
  
  <p>and on Mac OS X with</p>
  
  <ol>
  <li>gcc version 4.9.2</li>
  </ol>
  
  <p>but not with</p>
  
  <ol>
  <li>clang-600.0.56</li>
  <li>icpc version 15.0.1</li>
  </ol>
  
  <p>except if the macro <code>OK</code> is defined. I don't know which are the faulty compilers, could someone let me know ? Thanks.</p>
  
  <p>PS: here is the error</p>
  
  <pre><code>10:48: error: assigning to 'double' from incompatible type 'complex&lt;double&gt;'
          std::for_each(in, in + m, [](K&amp; z) { z = std::conj(z); });
  </code></pre>