Go Back   ZeroC Forums > Bug Reports

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old 03-01-2006
bpolivka bpolivka is offline
Registered User
 
Name: Brett Polivka
Organization: Magnetar Capital
Project: Financial Core Services
 
Join Date: Feb 2006
Posts: 15
derived constructor generation bug in slice2cpp

Slice2cpp is generating incorrect code for parameterized constructors of derived classes.

For example, when using the following slice file:

Code:
module Test
{
   class Base
   {
      int a;
   };

   class Derived extends Base
   {
      int b;
   };
};
slice2cpp generates the following constructor for Derived:

Code:
Test::Derived::Derived(::Ice::Int __ice_a, ::Ice::Int __ice_b) :
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
    Base(a),
#else
    ::Test::Base(a),
#endif
    b(__ice_b)
{
}
Notice that it is passing "a", the yet-to-be-initialized instance variable, to the Base constructor, not "__ice_a", the parameter passed to the Derived constructor. Thus, "a" will wind up being initialized with itself, which is obviously incorrect.

Here's a patch which seems to fix it:

Code:
--- src/slice2cpp/Gen.cpp.orig  2006-01-18 20:04:15.000000000 -0600
+++ src/slice2cpp/Gen.cpp       2006-03-01 09:39:48.000000000 -0600
@@ -2397,7 +2397,7 @@
                        {
                            upcall += ", ";
                        }
-                       upcall += fixKwd((*q)->name());
+                       upcall += "__ice_" + fixKwd((*q)->name());
                    }
                    upcall += ")";
                }
Thanks,
Brett Polivka
__________________
Brett Polivka
Core Financial Systems
Magnetar Capital LLC
Reply With Quote
  #2 (permalink)  
Old 03-01-2006
beagles's Avatar
beagles beagles is offline
ZeroC Staff
 
Name: Brent Eagles
Organization: ZeroC, Inc
Project: Ice Developer
 
Join Date: Feb 2003
Location: Newfoundland
Posts: 110
Thanks for the bug report! Your fix looks like it should work. We'll double check it an post an 'official' patch shortly.

Btw, you should include the name of the project you are using Ice for in your signature. See this posting for details.
Reply With Quote
  #3 (permalink)  
Old 03-01-2006
michi's Avatar
michi michi is offline
ZeroC Staff
 
Name: Michi Henning
Organization: ZeroC
Project: Ice
 
Join Date: Feb 2003
Location: Brisbane, Australia
Posts: 912
Thanks for the bug report. I've posted a patch in the patch forum. Please apply this to the 3.0.1 source.

The fix for this will be included in Ice 3.1, of course.

Cheers,

Michi.
Reply With Quote
  #4 (permalink)  
Old 03-02-2006
bpolivka bpolivka is offline
Registered User
 
Name: Brett Polivka
Organization: Magnetar Capital
Project: Financial Core Services
 
Join Date: Feb 2006
Posts: 15
Thank you guys for the amazingly fast turnaround!
__________________
Brett Polivka
Core Financial Systems
Magnetar Capital LLC
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
ICE 3.0.0 CS code generation issue DeepDiver Bug Reports 2 11-18-2005 02:48 PM
Java 5.0 code generation for slice2java vsonnathi Comments 2 11-17-2005 02:58 PM
C# code generation issue DeepDiver Bug Reports 3 09-01-2005 06:54 AM
Identity Constructor acbell Comments 1 08-30-2005 02:34 PM
Passing parameters to constructor jacopo Help Center 2 05-12-2005 01:47 PM


All times are GMT -4. The time now is 04:25 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.