Commit 25361fb6 authored by Mark Florisson's avatar Mark Florisson

Fix sizeof(my_fused_type)

parent d467658e
...@@ -7049,6 +7049,8 @@ class SizeofVarNode(SizeofNode): ...@@ -7049,6 +7049,8 @@ class SizeofVarNode(SizeofNode):
operand_as_type = self.operand.analyse_as_type(env) operand_as_type = self.operand.analyse_as_type(env)
if operand_as_type: if operand_as_type:
self.arg_type = operand_as_type self.arg_type = operand_as_type
if self.arg_type.is_fused:
self.arg_type = self.arg_type.specialize(env.fused_to_specific)
self.__class__ = SizeofTypeNode self.__class__ = SizeofTypeNode
self.check_type() self.check_type()
else: else:
......
...@@ -242,3 +242,10 @@ def test_fused_declarations(cython.integral i, cython.floating f): ...@@ -242,3 +242,10 @@ def test_fused_declarations(cython.integral i, cython.floating f):
print cython.typeof(squared_int) print cython.typeof(squared_int)
print cython.typeof(squared_float) print cython.typeof(squared_float)
print '%d %.2f' % (squared_int, squared_float) print '%d %.2f' % (squared_int, squared_float)
def test_sizeof_fused_type(fused_type1 b):
"""
>>> test_sizeof_fused_type[pure_cython.double](11.1)
"""
t = sizeof(b), sizeof(fused_type1), sizeof(double)
assert t[0] == t[1] == t[2], t
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