AW: [C++-sig] Virtual functions with default implementation.
Gottfried.Ganssauge at HAUFE.DE
Gottfried.Ganssauge at HAUFE.DE
Tue Dec 17 17:29:48 CET 2002
At least it's not the compiler: the same thing happens on MSVC6.
Cheers,
G.Gan?auge
> -----Ursprungliche Nachricht-----
> Von: Jacek Generowicz [mailto:jacek.generowicz at cern.ch]
> Gesendet: Dienstag, 17. Dezember 2002 16:39
> An: c++-sig at python.org
> Betreff: [C++-sig] Virtual functions with default implementation.
>
>
> By copying and pasting the example code from
>
> http://www.boost.org/libs/python/doc/tutorial/doc/class_virtua
> l_functions.html
>
> I constucted the following test program.
>
> ======================================================================
> #include <boost/python.hpp>
>
> using namespace boost::python;
>
> struct Base
> {
> virtual int f() { return 0; }
> virtual ~Base();
> };
>
> struct BaseWrap : Base
> {
> BaseWrap(PyObject* self_)
> : self(self_) {}
> int f() { return call_method<int>(self, "f"); }
> static int default_f(Base* b) { return b->Base::f(); } //
> <<=== added
> PyObject* self;
> };
>
> BOOST_PYTHON_MODULE(virt)
> {
> class_<Base, BaseWrap>("Base")
> .def("f", &BaseWrap::default_f)
> ;
> }
> ======================================================================
>
> This fails to compile (errors included below for completenes) with gcc
> 3.2 (and Boost 1.29).
>
> Is it me, is it the docs, or something else ?
>
> Thanks,
>
> Jacek.
>
>
>
> Tons of compiler output follows ...
>
>
>
> In file included from
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon.hpp:43,
> from virtualboost.cc:1:
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:184:42: warning: pasting "operator" and "+"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:185:42: warning: pasting "operator" and "-"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:186:42: warning: pasting "operator" and "*"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:187:42: warning: pasting "operator" and "/"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:188:42: warning: pasting "operator" and "%"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:189:49: warning: pasting "operator" and
> "<<" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:190:49: warning: pasting "operator" and
> ">>" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:191:42: warning: pasting "operator" and "&"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:192:42: warning: pasting "operator" and "^"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:193:40: warning: pasting "operator" and "|"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:194:39: warning: pasting "operator" and ">"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:195:40: warning: pasting "operator" and
> ">=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:196:39: warning: pasting "operator" and "<"
> does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:197:40: warning: pasting "operator" and
> "<=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:198:40: warning: pasting "operator" and
> "==" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:199:40: warning: pasting "operator" and
> "!=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:271:38: warning: pasting "operator" and
> "+=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:272:38: warning: pasting "operator" and
> "-=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:273:38: warning: pasting "operator" and
> "*=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:274:38: warning: pasting "operator" and
> "/=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:275:38: warning: pasting "operator" and
> "%=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:276:42: warning: pasting "operator" and
> "<<=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:277:42: warning: pasting "operator" and
> ">>=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:278:38: warning: pasting "operator" and
> "&=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:279:38: warning: pasting "operator" and
> "^=" does not give a valid preprocessing token
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/operators.hpp:280:37: warning: pasting "operator" and
> "|=" does not give a valid preprocessing token
> In file included from virtualboost.cc:1:
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon.hpp:62:8: warning: extra tokens at end of #endif directive
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/object/value_holder.hpp: In
> constructor
> `boost::python::objects::value_holder_back_reference<Held,
> BackReferenceType>::value_holder_back_reference(PyObject*,
> A0) [with A0 =
> boost::reference_wrapper<const Base>, Held = Base,
> BackReferenceType =
> BaseWrap]':
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/object/make_instance.hpp:65: instantiated from `static Holder* >
boost::python::objects::make_instance<T,
> Holder>::construct(boost::python::objects::instance<Holder>*,
> boost::reference_wrapper<const T>) [with T = Base, Holder =
> boost::python::objects::value_holder_back_reference<Base, BaseWrap>]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/object/make_instance.hpp:35: instantiated from `static PyObject* >
boost::python::objects::make_instance<T,
> Holder>::execute(Arg&) [with Arg = const
> boost::reference_wrapper<const Base>, T = Base, Holder =
> boost::python::objects::value_holder_back_reference<Base, BaseWrap>]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/object/class_wrapper.hpp:23: instantiated from `static PyObject* >
boost::python::objects::class_wrapper<Src, Holder,
> MakeInstance>::convert(const Src&) [with Src = Base, Holder =
> boost::python::objects::value_holder_back_reference<Base,
> BaseWrap>, MakeInstance =
> boost::python::objects::make_instance<Base,
> boost::python::objects::value_holder_back_reference<Base,
> BaseWrap> >]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/converter/to_python_function_type.hpp:24: instantiated from `static
PyObject* > boost::python::converter::as_to_python_function<T,
> ToPython>::convert(const void*) [with T = Base, ToPython =
> boost::python::objects::class_wrapper<Base,
> boost::python::objects::value_holder_back_reference<Base,
> BaseWrap>, boost::python::objects::make_instance<Base,
> boost::python::objects::value_holder_back_reference<Base,
> BaseWrap> > >]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/to_python_converter.hpp:32: instantiated from
`boost::python::to_python_converter<T, > Conversion>::to_python_converter()
[with T = Base, Conversion
> = boost::python::objects::class_wrapper<Base,
> boost::python::objects::value_holder_back_reference<Base,
> BaseWrap>, boost::python::objects::make_instance<Base,
> boost::python::objects::value_holder_back_reference<Base,
> BaseWrap> > >]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/class.hpp:80: instantiated from `void
> boost::python::detail::register_copy_constructor(const
> boost::mpl::bool_c<true>&, const SelectHolder&, T*) [with T =
> Base, SelectHolder =
> boost::python::objects::detail::select_value_holder<Base, BaseWrap>]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/class.hpp:422: instantiated from `void
> boost::python::class_<T, X1, X2, X3>::register_() const [with
> T = Base, X1 = BaseWrap, X2 =
> boost::python::detail::not_specified, X3 =
> boost::python::detail::not_specified]'
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
> hon/class.hpp:432: instantiated from
> `boost::python::class_<T, X1, X2, X3>::class_(const char*,
> const char*) [with T = Base, X1 = BaseWrap, X2 =
> boost::python::detail::not_specified, X3 =
> boost::python::detail::not_specified]'
> virtualboost.cc:22: instantiated from here
> /afs/cern.ch/sw/lcg/external/Boost/1.29.0/rh73_gcc32/boost/pyt
hon/object/value_holder.hpp:129: no
> matching function for call to
> `BaseWrap::BaseWrap(PyObject*&, const Base&)'
> virtualboost.cc:12: candidates are: BaseWrap::BaseWrap(const
> BaseWrap&)
> virtualboost.cc:14: BaseWrap::BaseWrap(PyObject*)
>
>
>
> _______________________________________________
> C++-sig mailing list
> C++-sig at python.org
> http://mail.python.org/mailman/listinfo/c++-sig
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20021217/804ba383/attachment.htm>
More information about the Cplusplus-sig
mailing list