[C++-sig] Trying to clone (again), with VC8

David Abrahams dave at boost-consulting.com
Thu Feb 23 15:02:56 CET 2006


"Paul F. Kunz" <Paul_Kunz at slac.stanford.edu> writes:

>    I'm having trouble with clone, again, but this time only with
> VC-8.0.  I get the following error message ...
>
> ;; This buffer is for notes you don't want to save, and for Lisp evaluation.
> ;; If you want to create a file, visit that file with C-x C-f,
> ;; then enter the text in that file's own buffer.
>
> Compiling...
> FunctionWrap.cxx
> ..\..\python\FunctionWrap.cxx(188) : error C2664: 'boost::implicit_cast' : cannot convert parameter 1 from 'boost::python::detail::method_result' to 'boost::python::api::object'
>         No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
>
> The code is
>
> clone () const
> {
> #ifndef HAVE_OLD_PYTHON
>   PyGILState_STATE state = PyGILState_Ensure ();
>
>   object py_result;
>
>   if (override clone = this->get_override("clone")) {
>      try {
> 	// The Python class author overrode clone; do
> 	// whatever she says
> 	py_result = boost::implicit_cast < object > ( clone() );
>      } catch ( error_already_set & ) {
>
> The same code works for gcc 3.2, and 4.0. on Linux and VC 7.1 on
> Windows with Boost_1_32.   Neither Boost version 1_32_0 nore 1_33_1
> works for VC 8.0.
>
> Any ideas?

Well, I'm surprised it works anywhere.  method_result has an implicit
conversion _to_ any type, and object has an implicit conversion _from_
any type.  If that's not ambiguous on a fully-conforming compiler, it
might be close enough to confuse vc8.

-- 
Dave Abrahams
Boost Consulting
www.boost-consulting.com




More information about the Cplusplus-sig mailing list