[omniORB] "using namespace" can't disambiguate generated types

Duncan Grisby duncan at grisby.org
Tue Jul 17 14:57:08 BST 2007


On Friday 13 July, "Tom O'Reilly" wrote:

> I've defined a module in my IDL interface, generated C++ code with
> omniIDL, and for some reason am unable to take advantage of the C++
> "using namespace" directive - thus I need to specify the actual
> namespace *everywhere* in my application code. Why the heck doesn't
> "using namespace" help disambiguate types in the generated classes?

[...]
> class BasicServer : virtual public POA_test::ServerTest {

I assume this is really POA_oreillyTest::ServerTest.

[...]
> using namespace oreillyTest;     // Don't want to use namespace everywhere
> 
> BasicServer::BasicServer(ServerTest::Status status) {  // COMPILER ERROR HERE!!!
>   _status = status;

I guess it has resolved ServerTest to be POA_oreillyTest::ServerTest
based on the inheritance, rather than using the namespace to find
oreillyTest::ServerTest. If you put the type definition of Status
outside the interface, I expect the namespace lookup will find it.

Cheers,

Duncan.

-- 
 -- Duncan Grisby         --
  -- duncan at grisby.org     --
   -- http://www.grisby.org --



More information about the omniORB-list mailing list