I have this simple program that works with threads. In Clang, I get a bunch of confusing errors. Here is the program:
#include <iostream> #include <thread> #include <future> int main() { std::packaged_task<int()> task([] { return 1; }); std::future<int> result = task.get_future(); task(); std::cout << "Result was: " << result.get(); }
Errors:
error: no correspondence constructor to initialize 'duration' (aka ' std::chrono::duration<long, std::ratio<1, 1000000> > '): _d (_t.time_since_epoch ()) note: when requested, it is requested here function template specification 'std::chrono::time_point<std::chrono::system_clock, std::chrono::duration<long, std::ratio<1, 1000000> > >::time_point<std::chrono::duration<long, std::ratio<1, 1000000000> > >' here
There is a lot more, but you can see it in this program link . Oddly enough, it compiles in g ++ 4.7.3 and 4.6.3. Why is this happening only in Clang?
Update:. As David remarked, this seems like a mistake when I include the <future> header.
template boy
source share