Why are some functions within a namespace accessible without the namespace scoping prefix?
<p>Shouldn't functions within a namespace only be accessible via using the namespace scoping or by the using directive?  </p>

<p>I am having a problem where certain functions, defined inside of a namespace, are accessible OUTSIDE of that namespace.  I believe there should be a compiler error, but I am not getting one across the three different compilers I have tried (VS.NET 2003, VS2010 and GCC 4).</p>

<p>Here is the code:</p>

<pre><code>namespace N{
  typedef struct _some_type *some_type;
  struct some_struct { int x; };
  void A(void);
  void B(int);
  void C(some_type*);
  void D(some_type);
  void E(struct some_struct);
}

using N::some_type;
using N::some_struct;

void TestFunction()
{
  some_type foo;
  some_struct s;

  N::A();         //should compile (and does on VS2003, VS2010, and GCC 4.1.2)
  ::A();          //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)
  A();            //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)

  N::B(0);        //should compile (and does on VS2003, VS2010, and GCC 4.1.2)
  ::B(0);         //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)
  B(0);           //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)

  N::C(&amp;foo);     //should compile (and does on VS2003, VS2010, and GCC 4.1.2)
  ::C(&amp;foo);      //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)
  C(&amp;foo);        //shouldn't compile (but does on VS2003, VS2010, and GCC 4.1.2) -- problem!

  N::D(foo);      //should compile (and does on VS2003, VS2010, and GCC 4.1.2)
  ::D(foo);       //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)
  D(foo);         //shouldn't compile (but does on VS2003, VS2010, and GCC 4.1.2) -- problem!

  N::E(s);        //should compile (and does on VS2003, VS2010, and GCC 4.1.2)
  ::E(s);         //shouldn't compile (and doesn't on VS2003, VS2010, and GCC 4.1.2)
  E(s);           //shouldn't compile (but does on VS2003, VS2010, and GCC 4.1.2) -- problem!
}
</code></pre>

<p>None of the functions should be accessible without using the N:: prefix, but C, D, and E are for some unknown reason.  I initially thought it was a compiler bug, but because I am seeing this across multiple compilers it makes me question what is going on.</p>
