Namespaces and scope visibility issue
<p>I made a header file <code>sampleheader.h</code> with following code:</p>

<pre><code>namespace sample_namespace
{
    int add(int n1,int n2)
    {
        return (n1 + n2);
    }
}
</code></pre>

<p>Now my main.cpp file is:</p>

<pre><code>#include &lt;iostream&gt;
#include "sampleheader.h"
using namespace std;

int add(int n1, int n2)
{
  return (n1 + n2);
}

int main(void)
{
    using namespace sample_namespace;
    //cout&lt;&lt;add(5,7);
}
</code></pre>

<p>The project is built with no warning if i leave that line commented.It is understandable because the local <code>add()</code> function is defined in the global scope and <code>add()</code> function is made visible in the scope of main(). So no name conflict happens.</p>

<p>However, if I remove the comments, I get the following error:</p>

<p><code>"Ambiguous call to overloaded function"</code></p>

<p>First of all there should be no name conflict at all as explained by me above (if I'm right). But, if at all there is a name conflict why is it that it is notified by compiler only when I call the function. Such type of error should be shown as soon as a name conflicts (if at all).</p>

<p>Any help is appreciated.</p>
