title: Why does this basic thread program fail with Clang but pass in g++?
body: <p>I have this simple program that works with threads. In Clang I get a bunch of confusing irrelevant errors. Here is the program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;thread&gt;
  #include &lt;future&gt;
  
  int main()
  {
     std::packaged_task&lt;int()&gt; task([] { return 1; });
     std::future&lt;int&gt; result = task.get_future();
  
     task();
  
     std::cout &lt;&lt; "Result was: " &lt;&lt; result.get();
  }
  </code></pre>
  
  <p>Errors:</p>
  
  <blockquote>
    <p>error: no matching constructor for initialization of 'duration' (aka '<code>std::chrono::duration&lt;long, std::ratio&lt;1, 1000000&gt; &gt;</code>')
                  : _<em>d(</em>_t.time_since_epoch())
    note: in instantiation of function template specialization <code>'std::chrono::time_point&lt;std::chrono::system_clock, std::chrono::duration&lt;long, std::ratio&lt;1, 1000000&gt; &gt; &gt;::time_point&lt;std::chrono::duration&lt;long, std::ratio&lt;1, 1000000000&gt; &gt; &gt;'</code> requested here</p>
  </blockquote>
  
  <p>There's a lot more, but you can see it in <a href="http://liveworkspace.org/code/4yc7Hy%243290" rel="nofollow">this link</a> of the program. Oddly, it compiles fine in g++ 4.7.3 and 4.6.3. Why is this only happening in Clang?</p>
  
  <p><strong>Update:</strong> As David pointed out, it seems only to be failing when I include the <code>&lt;future&gt;</code> header.</p>