Search

The explicit capture of an entity by a nested lambda-expression does not cause its implicit capture by the containing lambda-expression. by Сыроежка

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 736576
Opened: 4/12/2012 9:06:20 AM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
The explicit capture of an entity by a nested lambda-expression does not cause its implicit capture by the containing lambda-expression.
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

#include "stdafx.h"
#include    <iostream>

void f1( int i )
{
    auto m1 = [=] { auto m2 = [i] { std::cout << i << std::endl; }; m2(); };
    m1();
}

Product Language

Russian

Operating System

Windows 7

Operating System Language

Russian

Actual results

Compilation errors

error C3481: i: передаваемая переменная в лямбда-выражении не найдена
error C2065: i: необъявленный идентификатор
error C2065: i: необъявленный идентификатор
error C2064: результатом вычисления фрагмента не является функция, принимающая 0 аргументов

Expected results

The sample code shall be compiled
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 4/16/2012 at 11:44 AM
Hi:
    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 MS-Moderator10 [Feedback Moderator] on 4/12/2012 at 10:06 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Visual Studio Product Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by MS-Moderator01 on 4/12/2012 at 9:49 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.