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

Status : 

  Deferred<br /><br />
		The product team has reviewed this issue and has deferred it for consideration at a later time.<br /><br />
		A more detailed explanation for the resolution of this particular item may have been provided in the comments section.


1
0
Sign in
to vote
ID 767039 Comments
Status Closed Workarounds
Type Bug Repros 0
Opened 10/11/2012 5:33:19 AM
Access Restriction Public

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>"
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)