Bug #338

Strange warning in boost::python api generation

Added by pospelov over 6 years ago. Updated over 6 years ago.

Status:ResolvedStart date:26 Jul 2013
Priority:NormalDue date:
Assignee:pospelov% Done:

0%

Category:-
Target version:Sprint 15

Description

although everything semms to be working

/home/pospelov/development/git/BornAgain/Core/Samples/inc/Layer.h:65:18: warning: ‘virtual void Layer::setDecoration(IDecoration*)’ was hidden [-Woverloaded-virtual]
/home/pospelov/development/git/BornAgain/Core/PythonAPI/src/Layer.pypp.cpp:121:18: warning: by ‘virtual void Layer_wrapper::setDecoration(const IDecoration&)’ [-Woverloaded-virtual]

History

#1 Updated by pospelov over 6 years ago

  • Status changed from New to Sprint

#2 Updated by pospelov over 6 years ago

  • Target version set to Sprint 15

#3 Updated by pospelov over 6 years ago

  • Assignee set to pospelov

#4 Updated by pospelov over 6 years ago

  • Description updated (diff)

Ok, seems to be normal behavior. Indeed, Layer_wrapper : public Layer
from Layer.pypp.cpp implements only
setDecoration(const IDecoration &decor)
and not
setDecoration(IDecoration *decor)
because from python we need only first method.

But then compiler start to complain that setDecoration(IDecoration *decor) from Base class is hidden.

Example below produces same warning if compile with
g++ -Woverloaded-virtual main.cpp

class Base {
public:
Base(){}
virtual ~Base(){}

virtual void accept(const Object &obj)
{
std::cout << "Base::accept(const Object &obj) ->" << std::endl;
obj.print();
}
virtual void accept(Object *obj) {
std::cout << "Base::accept(const Object &obj) ->" << std::endl;
obj->print();
}

};

class Derived : public Base {
Derived(){}
virtual void accept(Object const & obj) {
std::cout << "Derived::accept(const Object &obj) ->" << std::endl;
obj.print();
}
};

main.cpp:23:18: warning: ‘virtual void Base::accept(Object*)’ was hidden [-Woverloaded-virtual]
main.cpp:34:18: warning: by ‘virtual void Derived::accept(const Object&)’ [-Woverloaded-virtual]

#5 Updated by pospelov over 6 years ago

  • Status changed from Sprint to Resolved

Also available in: Atom PDF