limethief

Running Visual Studio 2005 Professional, no service pack applied. Here is a code snippet distilled from some code that fails due to unexpected namespace conflicts:

namespace ns1 {
typedef unsigned long ns_t;
struct base
{
~base() {}
};
}

namespace ns2 {
using namespace ns1;
struct dummy : public base
{
};
}

namespace ns3 {
struct dummy2
{
dummy2() {}
ns2::dummy m_dummy;
};
}

ns_t ns_check; //compilation should fail here!!


The above code compiles fine on my machine. The problem is that , for some reason, ns_t is visible at the global namespace when it shouldn't be. Strangely, removing base::~base will cause the behavior I expect (compilation error).

I'm not sure exactly where the bug is and what a workaround might be. If someone from the VC team can reproduce this, I'd appreicate some information on how to avoid triggering the behavior.


Re: Visual C++ Language Unexpected namespace pollution in VC8 (bug?)

einaros

This issue is present in VC versions 7.0, 7.1 and 8.0. You should report it at http://connect.microsoft.com/VisualStudio. Post the resulting URL here.




Re: Visual C++ Language Unexpected namespace pollution in VC8 (bug?)


Re: Visual C++ Language Unexpected namespace pollution in VC8 (bug?)

Jonathan Caves - MSFT

I've looked at this and I can report that it was fixed in Visual C++ 2005 SP1.




Re: Visual C++ Language Unexpected namespace pollution in VC8 (bug?)

einaros

 Jonathan Caves - MSFT wrote:
I've looked at this and I can report that it was fixed in Visual C++ 2005 SP1.
Great!

It's about time Dinkumware update their compilers by the way. I didn't have VS handy, so I gave it a go with their online ones -- which apparently doesn't have SP1.