www.digitalmars.com         C & C++   DMDScript  

c++ - [bug] using namespace leaks into surrounding namespace.

The following shouldn't compile, but does. The commented line will fail
as expected if it's includeed.

   namespace n1
   {
     struct x {};
   }

   namespace n2
   {
     void y() { using namespace n1; }
     //x a;
   }

   n2::x b;

This also causes the following code to fail with an 'ambiguous reference
to symbol' error:

   namespace n1
   {
     struct x {};
   }

   namespace n2
   {
     void y() { using namespace n1; }
     struct x {};
   }

   n2::x a;
May 31 2005