Argument dependent name lookup and typedef
<p>I would not have expected this code to compile, but it does. My understanding is that <code>func(d)</code> it looks in the global namespace for a function called "func" but also in the namespace of any passed in parameters (Argument dependent lookup)</p>

<p>But in this case the parameter is in the global namespace. So why does it find "func" in the ns namespace? Are there special rules saying that if the parameter type is a typedef then it uses the namespace of the underlying type rather than the namespace of the actual parameter?</p>

<p>This appears to be true but I can't find anything supporting this... Is it the expected behavour?</p>

<pre><code>namespace ns
{
    struct data {};
    void func(ns::data item) {}
};

// Create an alias "datatype" in the global namespace for ns::data
typedef ns::data datatype;


int main()
{
    datatype d;
    func(d);
}
</code></pre>
