Home Bug Reports

Ice-3.1.0 - slice2cpp - interface seq in class

StuartAStuartA Member
ZeroC,

In porting my application to 3.1 (with patch #1) I encounted an error while compiling a generated file. Here is a simplified slice file with the same error
#ifndef __eg_ice__
#define __eg_ice__

module Eg
{     
      interface Children
      {
            void doSomething();
      };
      
      sequence<Children> ChildrenSeq;

      class Parent
      { 
            ChildrenSeq myChildren;
      };

};
#endif

and the compile output (g++ 3.3.5)
/usr/local/ZeroC/Ice-3.1.0/include/Ice/Handle.h: In constructor `
   IceInternal::Handle<T>::Handle(const IceInternal::Handle<Y>&) [with Y =
   Eg::Children, T = Eg::Parent]':
Fails.cpp:672:   instantiated from here
/usr/local/ZeroC/Ice-3.1.0/include/Ice/Handle.h:58: error: cannot convert `
   Eg::Children* const' to `Eg::Parent*' in assignment
Fails.cpp: In member function `virtual void
   Eg::Parent::__gcReachable(IceInternal::GCCountMap&) const':
Fails.cpp:164: error: in passing argument 1 of `void Eg::__addObject(const
   Eg::ParentPtr&, IceInternal::GCCountMap&)'
Fails.cpp: In member function `virtual void Eg::Parent::__gcClear()':
Fails.cpp:688: error: invalid initialization of reference of type '
   Eg::ParentPtr&' from expression of type 'IceInternal::Handle<Eg::Children>'
Fails.cpp:176: error: in passing argument 1 of `void
   Eg::__decRefUnsafe(Eg::ParentPtr&)'
Fails.cpp:689: error: invalid initialization of reference of type '
   Eg::ParentPtr&' from expression of type 'IceInternal::Handle<Eg::Children>'
Fails.cpp:182: error: in passing argument 1 of `void
   Eg::__clearHandleUnsafe(Eg::ParentPtr&)'

Best Regards
Stuart Argue

Comments

  • StuartAStuartA Member
    Sorry, false ararm.

    The sequence should be sequence<Children*> ChildrenSeq; and compiles as expected. Interestingly this went under the radar with Ice-3.0.1 (application still under development).

    Regards Stuart
  • michimichi Member Michi HenningOrganization: Triodia TechnologiesProject: I have a passing interest in Ice :-) ✭✭✭
    Thanks for reporting this. Even though, as you say, this doesn't affect you, it is still wrong: the compiler should generate valid code for this construct (although passing an interface by value is unusual).

    I've posted a patch for this problem. Because the patch is binary incompatible and requires rebuilding Ice, I suggest that you apply it only if you have a pressing need. The patch will be include in Ice 3.2, of course.

    Cheers,

    Michi.
Sign In or Register to comment.