Unexpected error C2751 reported at 'using namespace' directive inside a lambda expression. - by Viorel_

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 636634 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/18/2011 6:30:40 AM
Access Restriction Public


In shown situation, the 'using namespace' directive generates an error that seems to be unexpected:

namespace NamespaceA
    namespace NamespaceB

auto a = []() { using namespace NamespaceA::NamespaceB; };

The error is reported at 'using namespace' line:

error C2751: 'NamespaceA::NamespaceB' : the name of a function parameter cannot be qualified.

No error occurs if the 'a' variable is moved to a function.

Sign in to post a comment.
Posted by Xiang [MSFT] on 2/24/2011 at 12:46 PM
    Thanks for reporting the issue.
    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 1/18/2011 at 8:23 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 1/18/2011 at 6:58 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)