using namespace a::b; does not work in a lambda defined on the root level. - 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 637539 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 1/22/2011 4:24:03 AM
Access Restriction Public


This is a really odd one. Of course I had to write the strange code to encounter it ;-).

If you place a using directive of a nested namespace in a lambda defined on the root level the compiler gets serious hickups... The commented out code below are versions which do work, so the bug really needs several prerequisites:

namespace fopp {
	namespace fupp {

int x()
	using namespace fopp::fupp;

int y()
	auto ttt = [&]()->int { using namespace fopp::fupp; };

auto tt = [&]()->int { using namespace fopp; using namespace fupp; };

auto ttt = [&]()->int { using namespace fopp::fupp; };
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 Bengt Gustafsson on 2/17/2011 at 1:31 PM
the other similar bug is #644190
Posted by Bengt Gustafsson on 2/17/2011 at 1:27 PM
I now encountered this again in another context. The fact that it was on the root level is irrelevant, it happens the same inside a function, and actually in that case the using was before the lambda, not inside it. I did find that bug reported here before, so I didn't make a new report...
Posted by Helen [MSFT] on 1/23/2011 at 6:21 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 Microsoft on 1/22/2011 at 5:00 AM
Thank you for your feedback, we are currently reviewing the issue you have submitted. If this issue is urgent, please contact support directly(