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

Status : 

  Fixed<br /><br />
		This item has been fixed in the current or upcoming version of this product.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.

Sign in
to vote
ID 641032 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 2/2/2011 2:23:13 PM
Access Restriction Public


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; };
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(