Opened 7 years ago
Last modified 7 years ago
#11337 new Bugs
implicit_cast in python/include/boost/python/opaque_pointer_converter.hpp should be boost:: qualified
Reported by: | Owned by: | Ralf W. Grosse-Kunstleve | |
---|---|---|---|
Milestone: | To Be Determined | Component: | python USE GITHUB |
Version: | Boost Development Trunk | Severity: | Problem |
Keywords: | Cc: | gromer@… |
Description
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 ; }
Note:
See TracTickets
for help on using tickets.
Google ref: b/21321370