Home Dashboard Directory Help
Search

using namespace a::b; does not work in a lambda defined on the root level. by Bengt Gustafsson


Status: 

Closed
 as Fixed Help for as Fixed


1
0
Sign in
to vote
Type: Bug
ID: 637539
Opened: 1/22/2011 4:24:03 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

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; };
Details
Sign in to post a comment.
Posted by Microsoft on 2/24/2011 at 12:46 PM
Hi:
    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 Microsoft 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(http://support.microsoft.com)
Sign in to post a workaround.