[omniORB] Assigning an union to itself

Daniel Laügt daniel.laugt at wallstreetsystems.com
Tue Nov 25 10:39:27 GMT 2014


Hi,



I’m upgrading omniorb from 4.1.5 to 4.2.0. It seems there is a regression
on union due to the following revision:

http://sourceforge.net/p/omniorb/svn/5934/



I’m not able to assign anymore an union to itself. I guess a check for this
case is missing in the operator assignment…



test.idl:

module Test

{

  enum Value_Type

    {

      TYPE_INTEGER,

      TYPE_STRING

    };



  union Value switch (Value_Type)

    {

    case TYPE_INTEGER:

      long v_int;

    case TYPE_STRING:

      string v_string;

    };

};



test.cc:

#include <iostream>

#include <idl/Test.h>



int main (int argc, const char** argv)

{

  Test::Value v;

  v.v_string ("Test");



  v = v;



  std::cout << v.v_string ();



  return 0;

}



test.h:

Value& operator=(const Value& _value) {

  switch(static_cast<int> (_value._pd__d)) {

    case TYPE_INTEGER: v_int(_value.v_int()); break;



    case TYPE_STRING: v_string(_value.v_string()); break;



      default: break;





  }

  _pd__d = _value._pd__d;



  _pd__initialised = _value._pd__initialised;

  return *this;

}





In the operator assignment, I would add the following check (like
_CORBA_String_member in include/omniORB4/stringtypes.h):

if (&_value != this) {

}



Is it possible to add this check in the next releases?



Regards,

Daniel.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.omniorb-support.com/pipermail/omniorb-list/attachments/20141125/635c9195/attachment.html>


More information about the omniORB-list mailing list