Search

Unexpected error C2871 reported at 'using namespace' directive before a lambda expression by slide_b

Closed
as Fixed Help for as Fixed

3
0
Sign in
to vote
Type: Bug
ID: 644190
Opened: 2/15/2011 7:02:25 AM
Access Restriction: Public
0
Workaround(s)
1
User(s) can reproduce this bug
The folowing code:

namespace NamespaceA {
    namespace NamespaceB{
    }
}

int main(){
    using namespace NamespaceA::NamespaceB;
    auto a = []() {};
    return 0;
}

generates this error:
error C2871: 'NamespaceB' : a namespace with this name does not exist

The error is reported at 'auto a = []() {};' line.
Details (expand)

Visual Studio/Silverlight/Tooling version

Visual Studio 2010

What category (if any) best represents this feedback?

Reliability

Steps to reproduce

Create a new C++ project, 'Win32 Console Application', with default settings. Append these lines to CPP file:

#include "stdafx.h"

namespace NamespaceA {
    namespace NamespaceB{
    }
}

int main(){
    using namespace NamespaceA::NamespaceB;
    auto a = []() {};
    return 0;
}


Product Language

English

Operating System

Windows Vista

Operating System Language

Any

Actual results

Compiler Error:

error C2871: 'NamespaceB' : a namespace with this name does not exist

Expected results

No errors.
File Attachments
0 attachments
Sign in to post a comment.
Posted by Microsoft on 2/28/2011 at 7:25 PM
Hello,

Thank you for reporting this issue. We are aware of this bug and have fixed it in the current release we're working shipping next. Please expect this bug to be fixed in the next major release of Visual Studio. Thank you again for taking the time to report this bug.

Thanks,
Ulzii Luvsanbat
Windows C++ Team
Posted by Microsoft on 2/15/2011 at 6:25 PM
Thanks for your feedback.
We are routing 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 Microsoft on 2/15/2011 at 7:13 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.