title: Narrowing conversions and initializer lists, which compiler is right?
body: <p>Considering the following piece of code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  
  auto main() -&gt; int {
    double x(7.0);
    int i{x};
    std::cout &lt;&lt; "i = " &lt;&lt; x &lt;&lt; std::endl;
  
    return 0;
  }
  </code></pre>
  
  <hr>
  
  <ul>
  <li><p>When compiled in GCC4.9 it compiles fine with only a warning:</p>
  
  <blockquote>
    <blockquote>
      <p><code>warning: narrowing conversion of ‘x’ from ‘double’ to ‘int’ inside { }</code></p>
    </blockquote>
  </blockquote></li>
  </ul>
  
  <p><br /></p>
  
  <ul>
  <li><p>Compiling with either Clang3.3 or VC++2013 gives a compile error:  </p>
  
  <blockquote>
    <blockquote>
      <p><code>error: type 'double' cannot be narrowed to 'int' in initializer list</code>
      <code>error C2397: conversion from 'double' to 'int' requires a narrowing</code></p>
    </blockquote>
  </blockquote></li>
  </ul>
  
  <hr>
  
  <h2>Questions:</h2>
  
  <ul>
  <li><p>Which of the compilers is right according to the standard?</p></li>
  <li><p>Is there any reason why the compilers mentioned above should exhibit such diverse behaviour?</p></li>
  </ul>