Home Dashboard Directory Help
Search

ADL lookup calculate associated namespaces for classes inside functions incorrectly by Ivan Sorokin


Status: 

Closed
 as Deferred Help for as Deferred


1
0
Sign in
to vote
Type: Bug
ID: 767039
Opened: 10/11/2012 5:33:19 AM
Access Restriction: Public
0
Workaround(s)
view
0
User(s) can reproduce this bug

Description

MSVC compiles this code:

template <class T>
void f(T t)
{
    z(t);
}

namespace ns
{
    template<class T>
    void z(T)
    {}

    void g()
    {
        struct X
        {};

        f(X());
    }
}

int main()
{
    ns::g();
}

But this code is incorrect, because namespace ns is not associated namespace for class X.

According to C++ standard [basic.lookup.argdep]p2:
"If T is a class type (including unions), its associated classes are: the class itself; the class of which it is a member, if any; and its direct and indirect base classes. <b>Its associated namespaces are the namespaces of which its associated classes are members.</b>"
Details
Sign in to post a comment.
Posted by Microsoft on 10/11/2012 at 9:22 PM
Thanks for your feedback.

We are rerouting this issue to the appropriate group within the Microsoft Visual Studio Connect Support Team for triage and resolution. These specialized experts will follow-up with your issue.
Posted by Microsoft on 10/11/2012 at 5:50 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.