title: Why is there no narrowing conversion in this code, resulting in an error?
body: <p><code>g++</code> with <code>-std=c++11</code> seems to accept it:</p>
  
  <pre><code>#include &lt;vector&gt;
  #include &lt;initializer_list&gt;
  
  std::vector&lt;float&gt; vf={1,2,3}; // Isn't this narrowing (i.e., an error)?
  
  int main() {}
  </code></pre>
  
  <p>It would seem that the line with the comment should error out, but it does not.</p>
  
  <p><strong>Update</strong></p>
  
  <p>Thanks to Jesse for pointing to the standardese (8.5.4 p7) that defines why this is OK. Here is some sample code that helps to clarify the behavior defined by the standard:</p>
  
  <pre><code>const int v5=5;
  int v6=6;
  
  vector&lt;double&gt; vd1={1,2,3,4};       // OK
  vector&lt;double&gt; vd2={1,2,3,4,v5};    // Still OK, v5 is const
  vector&lt;double&gt; vd3={1,2,3,4,v5,v6}; // Error, narrowing conversion, because v6 
                                      // is non-const
  vector&lt;double&gt; vd4={1,2,3,4,v5,static_cast&lt;const int&gt;(v6)}; // Also errors on 
                                      // gcc 4.7.2, not sure why.
  </code></pre>
  
  <p>I hope that the examples I just presented will help others to get past some narrowing issues when using initializer lists.</p>
  
  <p>If anyone knows why the last case violates the standard definition, please post a comment.</p>