title: In C++, what do braces on the left-hand side of a variable declaration mean?
body: <p>The code at <a href="https://github.com/HertzDevil/0CC-FamiTracker/blob/e643e8cbad1c8bf01ff706245d72f93c33417de8/Source/FamiTracker.cpp#L446" rel="noreferrer">this GitHub file</a> uses a C++ variable "declaration" syntax I'm not familiar with:</p>
  
  <pre><code>std::unique_ptr&lt;CRecentFileList&gt; {m_pRecentFileList} = std::make_unique&lt;CRecentFileList&gt;(...
  </code></pre>
  
  <p>(<code>m_pRecentFileList</code> is declarared in a superclass.)</p>
  
  <p>What does it mean when you wrap a variable <strong>declaration</strong> in braces? (not an initializer list)</p>
  
  <hr>
  
  <p>I extracted a minimal test case which compiles:</p>
  
  <pre><code>class foo {
      int* p;
      void f(){
          std::unique_ptr&lt;int&gt; {p} = std::make_unique&lt;int&gt;(1);
      }
  };
  </code></pre>
  
  <p>Changing <code>int* p</code> to <code>std::unique_ptr&lt;int&gt; p</code> creates a compilation error due to <code>unique_ptr(const unique_ptr&amp;) = delete;</code></p>
  
  <p>This makes me think braced declaration assigns to a outer-scope variable with the same name. I tried creating a test program, but it fails to compile:</p>
  
  <pre><code>int main(){
      int x;
      int {x} = 1;
  }
  </code></pre>
  
  <blockquote>
    <p><code>error: using temporary as lvalue [-fpermissive]</code></p>
  </blockquote>