Commit 6aa5a11e authored by Stefan Behnel's avatar Stefan Behnel

fix compiler crash during type inference of indexed ctuples

parent 2ed50c7f
...@@ -2924,11 +2924,12 @@ class IndexNode(ExprNode): ...@@ -2924,11 +2924,12 @@ class IndexNode(ExprNode):
elif base_type.is_ptr or base_type.is_array: elif base_type.is_ptr or base_type.is_array:
return base_type.base_type return base_type.base_type
elif base_type.is_ctuple and isinstance(self.index, IntNode): elif base_type.is_ctuple and isinstance(self.index, IntNode):
index = self.index.constant_result if self.index.has_constant_result():
if index < 0: index = self.index.constant_result
index += base_type.size if index < 0:
if 0 <= index < base_type.size: index += base_type.size
return base_type.components[index] if 0 <= index < base_type.size:
return base_type.components[index]
if base_type.is_cpp_class: if base_type.is_cpp_class:
class FakeOperand: class FakeOperand:
......
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