Commit 68592200 authored by Robert Bradshaw's avatar Robert Bradshaw

<type?> does type check for extension types

parent 9eecd7bf
......@@ -2617,6 +2617,9 @@ class TypecastNode(ExprNode):
self.operand = self.operand.coerce_to(self.type, env)
else:
warning(self.pos, "No conversion from %s to %s, python object pointer used." % (self.type, self.operand.type))
elif from_py and to_py:
if self.typecheck and self.type.is_extension_type:
self.operand = PyTypeTestNode(self.operand, self.type, env)
def check_const(self):
self.operand.check_const()
......
......@@ -207,12 +207,18 @@ def p_typecast(s):
s.next()
base_type = p_c_base_type(s)
declarator = p_c_declarator(s, empty = 1)
if s.sy == '?':
s.next()
typecheck = 1
else:
typecheck = 0
s.expect(">")
operand = p_factor(s)
return ExprNodes.TypecastNode(pos,
base_type = base_type,
declarator = declarator,
operand = operand)
operand = operand,
typecheck = typecheck)
def p_sizeof(s):
# s.sy == ident "sizeof"
......
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