Commit d48faaeb authored by Stefan Behnel's avatar Stefan Behnel

array size must be set as int, not numeric string

parent ec09b000
...@@ -442,6 +442,11 @@ class CArrayDeclaratorNode(CDeclaratorNode): ...@@ -442,6 +442,11 @@ class CArrayDeclaratorNode(CDeclaratorNode):
if not self.dimension.type.is_int: if not self.dimension.type.is_int:
error(self.dimension.pos, "Array dimension not integer") error(self.dimension.pos, "Array dimension not integer")
size = self.dimension.result() size = self.dimension.result()
try:
size = int(size)
except ValueError:
# runtime constant?
pass
else: else:
size = None size = None
if not base_type.is_complete(): if not base_type.is_complete():
......
...@@ -616,6 +616,7 @@ class CArrayType(CType): ...@@ -616,6 +616,7 @@ class CArrayType(CType):
is_array = 1 is_array = 1
def __init__(self, base_type, size): def __init__(self, base_type, size):
assert size is None or isinstance(size, int), repr(size)
self.base_type = base_type self.base_type = base_type
self.size = size self.size = size
if base_type is c_char_type: if base_type is c_char_type:
......
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