Archived

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

C++11: Compiler errors in auto-generated slice code

I'm upgrading my C++ Ice project to use C++11, but I'm running in to problems with the auto-generated slice code.

I'm using g++ (Ubuntu/Linaro 4.7.3-2ubuntu4) 4.7.3. If I compile without '-std=c++11', everything compiles fine.

As far as I can tell, the ::Ice::Context parameter isn't getting named properly. In the non-C++11 code, a function definition has the following arguments -- ::Ice::Int ctx, const ::Ice::Context& __ctx -- but in the C++11 case it looks like this (notice the missing __): ::Ice::Int ctx, const ::Ice::Context& ctx

Here's what the compiler spits back:
./ice/Murmur.h:7852:190: error: conflicting declaration 'const Context& ctx'
./ice/Murmur.h:7852:163: error: 'ctx' has a previous declaration as 'Ice::Int ctx'
./ice/Murmur.h:7852:5: error: 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)' cannot be overloaded
./ice/Murmur.h:7842:5: error: with 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)'
./ice/Murmur.h:7857:190: error: conflicting declaration 'const Context& ctx'
./ice/Murmur.h:7857:163: error: 'ctx' has a previous declaration as 'Ice::Int ctx'
./ice/Murmur.h:7857:5: error: 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&)' cannot be overloaded
./ice/Murmur.h:7847:5: error: with 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&)'
./ice/Murmur.h:7864:214: error: conflicting declaration 'const Context* ctx'
./ice/Murmur.h:7864:187: error: 'ctx' has a previous declaration as 'Ice::Int ctx'
./ice/Murmur.h: In member function 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)':
./ice/Murmur.h:7844:103: error: no matching function for call to 'IceProxy::Murmur::Server::__begin_addContextCallback(Ice::Int&, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int&, int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)'
./ice/Murmur.h:7844:103: note: candidate is:
./ice/Murmur.h:7864:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::__begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)
./ice/Murmur.h:7864:27: note:   candidate expects 8 arguments, 9 provided
./ice/Murmur.h: In member function 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)':
./ice/Murmur.h:7854:106: error: no matching function for call to 'IceProxy::Murmur::Server::__begin_addContextCallback(Ice::Int&, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int&, Ice::Int*, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)'
./ice/Murmur.h:7854:106: note: candidate is:
./ice/Murmur.h:7864:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::__begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)
./ice/Murmur.h:7864:27: note:   candidate expects 8 arguments, 9 provided
./ice/Murmur.h: In member function 'Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&)':
./ice/Murmur.h:7859:114: error: no matching function for call to 'IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int&, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int&, Ice::Int*, Ice::CallbackPtr)'
./ice/Murmur.h:7859:114: note: candidates are:
./ice/Murmur.h:7842:5: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void()>&, const IceInternal::Function<void(const IceUtil::Exception&)>&, const IceInternal::Function<void(bool)>&)
./ice/Murmur.h:7842:5: note:   no known conversion for argument 7 from 'Ice::CallbackPtr {aka IceUtil::Handle<IceInternal::GenericCallbackBase>}' to 'const IceInternal::Function<void(const IceUtil::Exception&)>&'
./ice/Murmur.h:7847:5: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&, const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&)
./ice/Murmur.h:7847:5: note:   no known conversion for argument 6 from 'Ice::Int* {aka int*}' to 'const IceInternal::Function<void(const IceInternal::Handle<Ice::AsyncResult>&)>&'
./ice/Murmur.h:7905:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int)
./ice/Murmur.h:7905:27: note:   candidate expects 5 arguments, 7 provided
./ice/Murmur.h:7910:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const Context&)
./ice/Murmur.h:7910:27: note:   candidate expects 6 arguments, 7 provided
./ice/Murmur.h:7915:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const CallbackPtr&, const LocalObjectPtr&)
./ice/Murmur.h:7915:27: note:   no known conversion for argument 6 from 'Ice::Int* {aka int*}' to 'const CallbackPtr& {aka const IceUtil::Handle<IceInternal::GenericCallbackBase>&}'
./ice/Murmur.h:7920:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const Context&, const CallbackPtr&, const LocalObjectPtr&)
./ice/Murmur.h:7920:27: note:   no known conversion for argument 6 from 'Ice::Int* {aka int*}' to 'const Context& {aka const std::map<std::basic_string<char>, std::basic_string<char> >&}'
./ice/Murmur.h:7925:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const Callback_Server_addContextCallbackPtr&, const LocalObjectPtr&)
./ice/Murmur.h:7925:27: note:   no known conversion for argument 6 from 'Ice::Int* {aka int*}' to 'const Callback_Server_addContextCallbackPtr& {aka const IceUtil::Handle<Murmur::Callback_Server_addContextCallback_Base>&}'
./ice/Murmur.h:7930:27: note: Ice::AsyncResultPtr IceProxy::Murmur::Server::begin_addContextCallback(Ice::Int, const string&, const string&, const ServerContextCallbackPrx&, Ice::Int, const Context&, const Callback_Server_addContextCallbackPtr&, const LocalObjectPtr&)
...

Comments

  • benoit
    benoit Rennes, France
    Hi,

    This is a known issue that will be fixed with Ice 3.5.1. In the meantime, you can rename the "int ctx" parameter of the addContextCallback method in the Murmur.ice slice file (to "int cbCtx" for example). This should workaround the problem.

    Cheers,
    Benoit.
  • Yep, that's what I did. Just wanted to make sure you guys were aware of the issue as well. :)