Commit ac886ee9 authored by Xavier Thompson's avatar Xavier Thompson

Make cypclass isinstanceof work for const arguments

parent fe8b742b
......@@ -675,7 +675,7 @@ def inject_cypclass_typecheck_functions():
isinstanceof_type = PyrexTypes.CFuncType(
PyrexTypes.c_int_type,
[
PyrexTypes.CFuncTypeArg("obj", PyrexTypes.cy_object_type, None),
PyrexTypes.CFuncTypeArg("obj", PyrexTypes.const_cy_object_type, None),
PyrexTypes.CFuncTypeArg("type", template_placeholder_type, None)
],
nogil = 1,
......
......@@ -5040,6 +5040,7 @@ unspecified_type = UnspecifiedType()
py_object_type = PyObjectType()
cy_object_type = CypClassType('cyobject', None, "CyObject", None)
const_cy_object_type = ConstCypclassType(cy_object_type)
c_void_type = CVoidType()
......
......@@ -456,7 +456,7 @@
template <typename T, typename O>
static inline int isinstanceof(O ob) {
static_assert(std::is_convertible<T, CyObject *>::value, "wrong type 'T' for isinstanceof[T]");
return dynamic_cast<T>(ob) != NULL;
return dynamic_cast<const typename std::remove_pointer<T>::type *>(ob) != NULL;
}
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment