title: Brace-initialization vs. Parenthesis Bug
body: <p>I was filing a GCC bug for this, but I'd rather double-check this.</p>
  
  <p>Consider the following programs:</p>
  
  <pre><code>#include &lt;utility&gt;
  template&lt;typename T, typename A&gt;
  void F(A&amp;&amp; a) { T(std::forward&lt;A&gt;(a)); } // Note: () syntax.
  int main() { int i; F&lt;int&amp;&gt;(i); }
  </code></pre>
  
  <p>and:</p>
  
  <pre><code>#include &lt;utility&gt;
  template&lt;typename T, typename A&gt;
  void F(A&amp;&amp; a) { T{std::forward&lt;A&gt;(a)}; } // Note: {} syntax.
  int main() { int i; F&lt;int&amp;&gt;(i); }
  </code></pre>
  
  <p>Latest Clang and MSVC compilers accept both programs. GCC 5 and beyond accept the first program but reject the second, claiming <code>invalid cast of an rvalue expression of type 'int' to type 'int&amp;'</code>.</p>
  
  <p>Is this a GCC bug? Or is this indeed a difference between <code>T{}</code> and <code>T()</code> in the above context (and thus a bug in Clang and MSVC)?</p>
  
  <p><strong>Edit:</strong></p>
  
  <p>The issue can be narrowed down to the following simpler excerpts:</p>
  
  <pre><code>int i; (int&amp;){i};
  </code></pre>
  
  <p>and</p>
  
  <pre><code>int i; (int&amp;)(i);
  </code></pre>