<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><meta name="Generator" content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style></head><body lang="EN-GB" link="blue" vlink="purple"><div class="WordSection1"><p class="MsoNormal"><span lang="FR">Hi,</span></p><p class="MsoNormal"><span lang="FR"> </span></p><p class="MsoNormal">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:</p><p class="MsoNormal"><a href="http://sourceforge.net/p/omniorb/svn/5934/">http://sourceforge.net/p/omniorb/svn/5934/</a></p><p class="MsoNormal"> </p><p class="MsoNormal">I’m not able to assign anymore an union to itself. I guess a check for this case is missing in the operator assignment…</p><p class="MsoNormal"> </p><p class="MsoNormal">test.idl:</p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">module Test</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">{</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  enum Value_Type</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">      TYPE_INTEGER,</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">      TYPE_STRING</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    };</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  union Value switch (Value_Type)</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    case TYPE_INTEGER:</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">      long v_int;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    case TYPE_STRING:</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">      string v_string;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    };</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">};</span></p><p class="MsoNormal"> </p><p class="MsoNormal">test.cc:</p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">#include &lt;iostream&gt;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">#include &lt;idl/Test.h&gt;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">int main (int argc, const char** argv)</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">{</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  Test::Value v;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  v.v_string (&quot;Test&quot;);</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  v = v;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  std::cout &lt;&lt; v.v_string ();</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  return 0;</span></p><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;background:white">}</span></p><p class="MsoNormal"> </p><p class="MsoNormal">test.h:</p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">Value&amp; operator=(const Value&amp; _value) {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  switch(static_cast&lt;int&gt; (_value._pd__d)) {</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    case TYPE_INTEGER: v_int(_value.v_int()); break;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">    case TYPE_STRING: v_string(_value.v_string()); break;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">      default: break;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white"> </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">      </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  }</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  _pd__d = _value._pd__d;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  </span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  _pd__initialised = _value._pd__initialised;</span></p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">  return *this;</span></p><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;background:white">}</span><span style="font-size:9.5pt;font-family:Consolas"></span></p><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;color:black"> </span></p><p class="MsoNormal"> </p><p class="MsoNormal">In the operator assignment, I would add the following check (like _CORBA_String_member in include/omniORB4/stringtypes.h):</p><p class="MsoNormal" style="text-autospace:none"><span style="font-size:9.5pt;font-family:Consolas;background:white">if (&amp;_value != this) {</span></p><p class="MsoNormal"><span style="font-size:9.5pt;font-family:Consolas;background:white">}</span></p><p class="MsoNormal"> </p><p class="MsoNormal">Is it possible to add this check in the next releases?</p><p class="MsoNormal"> </p><p class="MsoNormal">Regards,</p><p class="MsoNormal">Daniel.</p><p class="MsoNormal"> </p></div></body></html>