[omniORB] Union problem in GCC 4.x

Timothy J Brandt brandt at kcco.com
Fri May 18 10:45:39 BST 2007


This was originally noted in July 2005.  I wonder if I have missed 
something since then.
Below is the orginal description.  I still see this in  omniORB 4.1.0's 
omniidl.

Tim Brandt

When  using de the following IDL union def:

    module Test
    {
        typedef long UnionDiscrType;

        union TestUnion switch (UnionDiscrType)
        {
            case -1: short x;
            case 1: long y;
        };
    };
 
and compiling with g++-4, I get the following errors:

unionDynSK.cc:25: warning: converting negative value '-0x000000001' to
'CORBA::PR_unionDiscriminator'
unionDynSK.cc: In static member function 'static void
_0RL_tcParser_unionhelper_Test_mTestUnion::getDiscriminator(const
omni::tcUnionDesc*, omni::tcDescriptor&,
CORBA::PR_unionDiscriminator&)':
union.hh:195: error: 'CORBA::Long Test::TestUnion::_pd__d' is private
unionDynSK.cc:41: error: within this context
union.hh:195: error: 'CORBA::Long Test::TestUnion::_pd__d' is private
unionDynSK.cc:42: error: within this context
unionDynSK.cc: In static member function 'static void
_0RL_tcParser_unionhelper_Test_mTestUnion::setDiscriminator(const
omni::tcUnionDesc*, CORBA::PR_unionDiscriminator, int)':
union.hh:195: error: 'CORBA::Long Test::TestUnion::_pd__d' is private
unionDynSK.cc:47: error: within this context
union.hh:196: error: 'CORBA::Boolean Test::TestUnion::_pd__default' is 
private
unionDynSK.cc:48: error: within this context
unionDynSK.cc: In static member function 'static CORBA::Boolean
_0RL_tcParser_unionhelper_Test_mTestUnion::getValueDesc(const
omni::tcUnionDesc*, omni::tcDescriptor&)':
union.hh:195: error: 'CORBA::Long Test::TestUnion::_pd__d' is private
unionDynSK.cc:53: error: within this context
union.hh:200: error: 'CORBA::Short Test::TestUnion::<anonymous
union>::_pd_x' is private
unionDynSK.cc:55: error: within this context
union.hh:202: error: 'CORBA::Long Test::TestUnion::<anonymous
union>::_pd_y' is private
unionDynSK.cc:58: error: within this context

showing that:

* negative values for union discriminator is converted to unsigned
long (it shouldn't be that way, I'm I right?)
* a friend class declaration is not correct for g++ 4:

    #if defined(__GNUG__) || defined(__DECCXX) && (__DECCXX_VER < 60000000)
    friend class _0RL_tcParser_unionhelper_Test_mTestUnion;
#else
    friend class ::_0RL_tcParser_unionhelper_Test_mTestUnion;
#endif

=> the :: version is necessary for g++ 4

renej



More information about the omniORB-list mailing list