Archived

This forum has been archived. Please start a new discussion on GitHub.

Patch for slice2cpp posible bug

xdm
xdm La Coruña, Spain
Ice-3.0.1
gcc version 3.3.6 (Gentoo 3.3.6, ssp-3.3.6-1.0, pie-8.7.8)


Bug report

generated code with slice2cpp patch apply

Oz::App::Session::Session(const ::Ice::Identity& __ice_id, const ::Oz::Domains::DomainServerManagerPrx& __ice_domainServerManager, const ::Oz::Files::FileServerManagerPrx& __ice_fileServerManager, const ::Oz::MetaService::MetaServerManagerPrx& __ice_metaServerManager) :
Session(__ice_id),
domainServerManager(__ice_domainServerManager),
fileServerManager(__ice_fileServerManager),
metaServerManager(__ice_metaServerManager)
{
}

Compiler error in this code

g++ -c -pipe -Wall -W -O2 -march=pentium4 -D_REENTRANT -fPIC -DQT_NO_DEBUG -DQT_THREAD_SUPPORT -I/usr/qt/3/mkspecs/linux-g++ -I. -I/opt/Ice-3.0.1/include -I../../../c++/include -I../../../../Services/c++/include -I/usr/qt/3/include -o .obj/Session.o ../../src/App/Session.cpp
../../src/App/Session.cpp: In constructor `Oz::App::Session::Session(const
Ice::Identity&, const Oz::Domains::DomainServerManagerPrx&, const
Oz::Files::FileServerManagerPrx&, const
Oz::MetaService::MetaServerManagerPrx&)':
../../src/App/Session.cpp:672: error: type `class Oz::App::Session' is not a
direct or virtual base of `Oz::App::Session'
make: *** [.obj/Session.o] Error 1


generated code with out slice2cpp patch this compile without errors

Oz::App::Session::Session(const ::Ice::Identity& __ice_id, const ::Oz::Domains::DomainServerManagerPrx& __ice_domainServerManager, const ::Oz::Files::FileServerManagerPrx& __ice_fileServerManager, const ::Oz::MetaService::MetaServerManagerPrx& __ice_metaServerManager) :
#if defined(_MSC_VER) && (_MSC_VER < 1300) // VC++ 6 compiler bug
Session(id),
#else
::Oz::Base::Session(id),
#endif
domainServerManager(__ice_domainServerManager),
fileServerManager(__ice_fileServerManager),
metaServerManager(__ice_metaServerManager)
{
}

SLICE DEFINITIONS

---Base/Session.ice---
#ifndef _Oz_Base_Session_ICE_
#define _Oz_Base_Session_ICE_

#ifndef INCLUDE_ICE_IDENTITY
#define INCLUDE_ICE_IDENTITY
#include <Ice/Identity.ice>
#endif
#ifndef INCLUDE_GLACIER2_SESSION
#define INCLUDE_GLACIER2_SESSION
#include <Glacier2/Session.ice>
#endif

module Oz
{
module Base
{
class Session;
interface SessionAdmin extends Glacier2::Session
{
nonmutating Ice::Identity getId();
};

class Session implements SessionAdmin
{
Ice::Identity id;
};
};
};
#endif

App/Session.ice

module Oz
{
module App
{
interface SessionAdmin
{
Oz::Domains::DomainServerManager* getDomainManager();
Oz::Files::FileServerManager* getFileManager();
Oz::MetaService::MetaServerManager* getMetaManager();
};

class Session
extends Oz::Base::Session
implements SessionAdmin
{
Oz::Domains::DomainServerManager* domainServerManager;
Oz::Files::FileServerManager* fileServerManager;
Oz::MetaService::MetaServerManager* metaServerManager;
};
};
};

Comments

  • Thanks for the bug report. Looks like the problem is caused by the base class having the same name as the derived class (Session). The compiler should (but doesn't) emit a scoped name when it calls the base class constructor.

    As a work-around for the time being, the generated code should compile if you rename the derived class to something other than "Session".

    Cheers,

    Michi.