title: Why can't std::make_unique deduce the type of brace-initialized parameters?
body: <p>Consider the following code snippet</p>
  
  <pre class="lang-cpp prettyprint-override"><code>#include &lt;memory&gt;
  
  struct A {
      int x, y;
  };
  
  struct B{
      A a;
  
      B(A a): a(a) {}
  };
  
  int main() {
      // Ok
      B({2,3});
  
      // Ok
      auto ptr = new B({2,3});
  
      // Ok
      auto ptr_2 = std::make_unique&lt;B&gt;(A{2, 3});
  
      // Error
      auto ptr_3 = std::make_unique&lt;B&gt;({2, 3});
  }
  </code></pre>
  
  <p>When initializing a <code>B</code> object in the first two ways, one can create a temporary <code>A</code> constructor parameter without naming the type and the compiler can figure out what it represents and what constructor it should call.</p>
  
  <p>However, <code>std::make_unique</code> fails to compile without explicitly naming the type of the parameter. According to <a href="https://en.cppreference.com/w/cpp/memory/unique_ptr/make_unique" rel="nofollow noreferrer">cppreference</a>, the function call is equivalent to</p>
  
  <pre class="lang-cpp prettyprint-override"><code>unique_ptr&lt;T&gt;(new T(std::forward&lt;Args&gt;(args)...))
  </code></pre>
  
  <p>I had expected the call with <code>std::forward</code> to be equivalent to <code>new B({2,3});</code>, but that is not the case on the compilers I tested, namely gcc and clang trunk. Are they wrong? If not, why does forwarding the arguments not work as I expected?</p>