Search

std::async fails compilation for Callable with two or more arguments. by GhostlyGhost

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 729760
Opened: 3/8/2012 9:18:38 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
1
User(s) can reproduce this bug
In order to call std::async() with a Callable that takes two or more arguments, only the form std::async() which takes a launch policy compiles. Using the form which does not take a launch policy fails to compile.
Details (expand)

Visual Studio/Team Foundation Server/.NET Framework Tooling version

Visual Studio 11 Beta

Steps to reproduce

The following code demonstrates the problem:


std::async([](){});    // Compiles

std::async([](int){}, 0);    // Compiles.

std::async([](int, int){}, 0, 0);    // Doesn't compile.
    
std::async(std::launch::any, [](int, int){}, 0, 0);    // Compiles.

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

Compilation failure.

Expected results

Either forms of std::async() should compile, regardless of the Callable's number of arguments.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 3/23/2012 at 8:11 PM
Hi,

Thanks for reporting this bug. We've fixed it, and the fix will be available in VC11.

This one was interesting because the C++11 Standard's specification for async() is actually broken, resulting in this error. There are two overloads of async(), one that takes a launch policy and one that doesn't, and while the Standard attempted to make them unambiguous, its attempt was incomplete. I changed our implementation to properly constrain the second overload.

If you have any further questions, feel free to E-mail me at stl@microsoft.com .

Stephan T. Lavavej
Visual C++ Libraries Developer
Posted by MS-Moderator09 [Feedback Moderator] on 3/8/2012 at 11:11 PM
Thank you for submitting feedback on Visual Studio 11 and .NET Framework. Your issue has been routed to the appropriate VS development team for review. We will contact you if we require any additional information.
Posted by MS-Moderator01 on 3/8/2012 at 9:59 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(http://support.microsoft.com)
Sign in to post a workaround.