[Boost-bugs] [Boost C++ Libraries] #11337: implicit_cast in python/include/boost/python/opaque_pointer_converter.hpp should be boost:: qualified

Subject: [Boost-bugs] [Boost C++ Libraries] #11337: implicit_cast in python/include/boost/python/opaque_pointer_converter.hpp should be boost:: qualified
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2015-05-23 22:44:41


#11337: implicit_cast in python/include/boost/python/opaque_pointer_converter.hpp
should be boost:: qualified
---------------------------------------------+---------------------
 Reporter: Paul Pluzhnikov <ppluzhnikov@…> | Owner: rwgk
     Type: Bugs | Status: new
Milestone: To Be Determined | Component: Python
  Version: Boost 1.57.0 | Severity: Problem
 Keywords: |
---------------------------------------------+---------------------
 The following test case fails to compile:


 {{{
 template <typename T>
 inline T implicit_cast (void *) {
   // In reality there is an actual ::implicit_cast implementation in a
 header file
   return 0;
 }

 #include <boost/python.hpp>

 int main() {
   return 0;
 }

 }}}

 The error is:


 {{{
 In file included from ./python/include/boost/python.hpp:49:0,
                  from /tmp/implicit_cast.cc:6:
 ./python/include/boost/python/opaque_pointer_converter.hpp: In static
 member function ‘static void*
 boost::python::opaque<Pointee>::extract(PyObject*)’:
 ./python/include/boost/python/opaque_pointer_converter.hpp:66:68: error:
 call of overloaded ‘implicit_cast(PyObject*&)’ is ambiguous
              ? static_cast<python_instance*>(implicit_cast<void*>(op))->x
                                                                     ^
 ./python/include/boost/python/opaque_pointer_converter.hpp:66:68: note:
 candidates are:
 In file included from
 ./python/include/boost/python/converter/builtin_converters.hpp:11:0,
                  from
 ./python/include/boost/python/converter/arg_to_python.hpp:17,
                  from ./python/include/boost/python/call.hpp:15,
                  from ./python/include/boost/python/object_core.hpp:14,
                  from ./python/include/boost/python/args.hpp:25,
                  from ./python/include/boost/python.hpp:11,
                  from /tmp/implicit_cast.cc:6:
 ./conversion/include/boost/implicit_cast.hpp:25:10: note: T
 boost::implicit_cast(typename boost::detail::icast_identity<T>::type)
 [with T = void*; typename boost::detail::icast_identity<T>::type = void*]
  inline T implicit_cast (typename boost::detail::icast_identity<T>::type
 x) {
           ^
 /tmp/implicit_cast.cc:2:10: note: T implicit_cast(void*) [with T = void*]
  inline T implicit_cast (void *) {
           ^

 }}}

 Proposed fix:


 {{{
 diff --git a/include/boost/python/opaque_pointer_converter.hpp
 b/include/boost/python/opaque_pointer_converter.hpp
 index 10eb423..70ab1fe 100644
 --- a/include/boost/python/opaque_pointer_converter.hpp
 +++ b/include/boost/python/opaque_pointer_converter.hpp
 @@ -63,7 +63,7 @@ private:
      static void* extract(PyObject* op)
      {
          return PyObject_TypeCheck(op, &type_object)
 - ? static_cast<python_instance*>(implicit_cast<void*>(op))->x
 + ?
 static_cast<python_instance*>(boost::implicit_cast<void*>(op))->x
              : 0
              ;
      }
 }}}

-- 
Ticket URL: <https://svn.boost.org/trac/boost/ticket/11337>
Boost C++ Libraries <http://www.boost.org/>
Boost provides free peer-reviewed portable C++ source libraries.

This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:18 UTC