title: C++ async return value different when using x64
body: <p>The following Code compiles using both Debug\Win32 and Debug \ <strong>x64</strong> settings in VC2013, but when I use Debug \ <strong>x64</strong> i get the following <strong>IntelliSense Error</strong>:</p>
  
  <pre><code>    IntelliSense: no operator "=" matches these operands
      operand types are: std::future&lt;bar&lt;int&gt;&gt; = std::future&lt;bar&lt;int&gt; (&amp;)(bar&lt;int&gt; v)&gt;    
  </code></pre>
  
  <p>The Error refers to this function in Header.cpp:</p>
  
  <pre><code>bar&lt;int&gt; test::call(bar&lt;int&gt; v)
  {
      std::future&lt;bar&lt;int&gt;&gt; ret;
      ret = std::async(std::launch::async, &amp;test::exec, this, v);
  
      return ret.get();
  }
  </code></pre>
  
  <p>Why does std::async return something diffrent when using x64? </p>
  
  <p>return value win32:</p>
  
  <pre><code>std::future&lt;bar&lt;int&gt;&gt;
  </code></pre>
  
  <p>return value x64:</p>
  
  <pre><code>std::future&lt;bar&lt;int&gt; (&amp;)(bar&lt;int&gt;
  </code></pre>
  
  <p>How can i fix this for x64?</p>
  
  <hr>
  
  <p>My Code:</p>
  
  <p>Header.h</p>
  
  <pre><code>#pragma once
  #include &lt;future&gt;
  #include &lt;iostream&gt;
  
  using namespace std;
  
  template &lt;typename T&gt;
  class bar
  {
  public:
      bar()
      {
          state = 9;
      }
  
      void dec(){ state--; }
  
      T show()
      {
          return state;
      }
  
  private:
      T state;
  };
  
  
  
  class test{
  public:
      test(int a);
  
  public:
      bar&lt;int&gt; call(bar&lt;int&gt; v);
  
  private:
      bar&lt;int&gt; exec(bar&lt;int&gt; v);
  
  
  
  
  private:
      int value;
  };
  </code></pre>
  
  <p>Header.cpp</p>
  
  <pre><code>#include "Header.h"
  
  
  using namespace std;
  
  
  test::test(int a)
  {
      value = a;
  }
  
  bar&lt;int&gt; test::call(bar&lt;int&gt; v)
  {
      std::future&lt;bar&lt;int&gt;&gt; ret;
      ret = std::async(std::launch::async, &amp;test::exec, this, v);
  
      return ret.get();
  }
  
  bar&lt;int&gt; test::exec(bar&lt;int&gt; v)
  {
      v.dec();
      v.dec();
      return v;
  }
  </code></pre>
  
  <p>Source.cpp</p>
  
  <pre><code>#include &lt;future&gt;
  #include &lt;iostream&gt;
  
  #include "Header.h"
  
  using namespace std;   
  
  int main()
  {
      test object(4);
      bar&lt;int&gt; foo;
      bar&lt;int&gt; other = object.call(foo);
      std::cout &lt;&lt; other.show();
      getchar();
  }
  </code></pre>
  
  <p><strong>Edit:</strong>
  I do not want to use auto, because auto would not work in other scenarios (for example creating a vector of futures and then pushing back futures)</p>
  
  <p>This Error is <strong>NOT</strong> a <strong>compiler error</strong>, the code compiles and executes flawlesly ==> i can't post the compiler error because there is no compiler error. I just want to get rid of the VC IntelliSense Error</p>
  
  <p>Using std::move() does not solve the problem, i still get an IntelliSense Error:
  (The Code compiles and executes perfectly with and without the use of std::move)</p>
  
  <pre><code>IntelliSense: no operator "=" matches these operands
              operand types are: std::future&lt;bar&lt;int&gt;&gt; = std::future&lt;bar&lt;int&gt; (&amp;)(bar&lt;int&gt; v)&gt;
  </code></pre>