Commit 4c48e8d4 authored by Robert Bradshaw's avatar Robert Bradshaw

Fix enum bug (values weren't forced to ints)

parent 2c056908
...@@ -947,7 +947,8 @@ class NameNode(AtomicExprNode): ...@@ -947,7 +947,8 @@ class NameNode(AtomicExprNode):
namespace, namespace,
self.entry.name, self.entry.name,
code.error_goto_if_null(self.result_code, self.pos))) code.error_goto_if_null(self.result_code, self.pos)))
elif entry.is_local: elif entry.is_local and False:
# control flow not good enough yet
assigned = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos) assigned = entry.scope.control_flow.get_state((entry.name, 'initalized'), self.pos)
if assigned is False: if assigned is False:
error(self.pos, "local variable '%s' referenced before assignment" % entry.name) error(self.pos, "local variable '%s' referenced before assignment" % entry.name)
......
...@@ -728,6 +728,9 @@ class CEnumDefItemNode(StatNode): ...@@ -728,6 +728,9 @@ class CEnumDefItemNode(StatNode):
def analyse_declarations(self, env, enum_entry): def analyse_declarations(self, env, enum_entry):
if self.value: if self.value:
self.value.analyse_const_expression(env) self.value.analyse_const_expression(env)
if not self.value.type.is_int:
self.value = self.value.coerce_to(PyrexTypes.c_int_type, env)
self.value.analyse_const_expression(env)
value = self.value.result_code value = self.value.result_code
else: else:
value = self.name value = self.name
......
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