VS 11 with std::future - Is this a bug?
Posted
by
cooky451
on Stack Overflow
See other posts from Stack Overflow
or by cooky451
Published on 2012-02-22T05:12:18Z
Indexed on
2012/05/31
16:40 UTC
Read the original article
Hit count: 330
I recently installed the Visual Studio 11 Developer Preview. While playing with threads and futures, I came around this setup:
#include <future>
#include <iostream>
int foo(unsigned a, unsigned b)
{
return 5;
}
int main()
{
std::future<int> f = std::async(foo, 5, 7);
std::cout << f.get();
}
So, very simple. But since there are two arguments for "foo", VS 11 doesn't want to compile it. (However, g++ does: http://ideone.com/ANrPj) (The runtime error is no problem: std::future exception on gcc experimental implementation of C++0x) (VS 11 errormessage: http://pastebin.com/F9Xunh2s)
I'm a little confused right now, since this error seems extremely obvious to me, even if it is a developer preview. So my questions are:
- Is this code correct according to the C++11 standard?
- Is this bug already known/reported?
© Stack Overflow or respective owner