Home Dashboard Directory Help
Search

Lambda's automagic ctor gets wrong signature (or call) when implicit and explicit capture is mixed. by Bengt Gustafsson


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 641032
Opened: 2/2/2011 2:23:13 PM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

In the code below the compiler complains about its own implicit ctor for the inner lambda not being matched to the call signature.

This somehow has to do with the implicit const added to the x ctor parameter of the outer lambda not being added when the ctor for the inner lambda is built...

A workaround exist: Make the outer lamdba mutable.

void func()
{
    int x;
    int y;
    [&, x]()->void {
        [&]() { x; y; };
    };
}
Details
Sign in to post a comment.
Posted by Microsoft on 6/13/2011 at 9:33 AM
Hi Bengt:
    A fix for this issue has been checked into the compiler sources. The fix should show up in the next release of Visual C++.

Xiang Fan
Visual C++ Team
Posted by Microsoft on 2/2/2011 at 3:00 PM
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.