Search

Invalid error error C2871 when using functions defined within nested namespaced in lambdas. by TheTFo

Closed
as Fixed Help for as Fixed

1
0
Sign in
to vote
Type: Bug
ID: 688198
Opened: 9/13/2011 2:02:19 PM
Access Restriction: Public
Moderator Decision: Sent to Engineering Team for consideration
0
Workaround(s)
0
User(s) can reproduce this bug
I get error C2871 when I use function defined within nested namespaces in a lambda
Details (expand)

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

Visual Studio 2010 SP1

Steps to reproduce

Empty Project, Build

#include <iostream>

namespace Outer
{
    namespace Middle
    {
        namespace Inner
        {
            void f(int) {}
        }
    }
}

int Harness()
{
    using namespace Outer;
    using namespace Outer::Middle;
    using namespace Outer::Middle::Inner;

    auto lam = []() {
        f(42);
    };

    return 0;
}

int main()
{
    return Harness();
}

Product Language

English

Operating System

Windows 7

Operating System Language

English

Actual results

1>------ Build started: Project: Sandbox, Configuration: Debug Win32 ------
1>Build started 9/13/2011 4:59:37 PM.
1>InitializeBuildStatus:
1> Touching "Debug\Sandbox.unsuccessfulbuild".
1>ClCompile:
1> main.cpp
1>c:\users\u0095655\documents\visual studio 2010\projects\sandbox\sandbox\main.cpp(21): error C2871: 'Inner' : a namespace with this name does not exist
1>c:\users\u0095655\documents\visual studio 2010\projects\sandbox\sandbox\main.cpp(21): error C2871: 'Middle' : a namespace with this name does not exist
1>c:\users\u0095655\documents\visual studio 2010\projects\sandbox\sandbox\main.cpp(22): error C3861: 'f': identifier not found
1>
1>Build FAILED.
1>
1>Time Elapsed 00:00:00.36
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

Expected results

Successful build
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 9/14/2011 at 11:02 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 9/13/2011 at 9:29 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 9/13/2011 at 2:43 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.