Commit 58e7e5de authored by Robert Bradshaw's avatar Robert Bradshaw

Allow unary negation and complement for enum types.

parent 6af313c9
......@@ -5501,6 +5501,8 @@ class UnaryMinusNode(UnopNode):
if self.operand.type.is_numeric:
self.type = PyrexTypes.widest_numeric_type(
self.operand.type, PyrexTypes.c_int_type)
elif self.operand.type.is_enum:
self.type = PyrexTypes.c_int_type
else:
self.type_error()
if self.type.is_complex:
......@@ -5527,6 +5529,8 @@ class TildeNode(UnopNode):
if self.operand.type.is_int:
self.type = PyrexTypes.widest_numeric_type(
self.operand.type, PyrexTypes.c_int_type)
elif self.operand.type.is_enum:
self.type = PyrexTypes.c_int_type
else:
self.type_error()
......
......@@ -25,5 +25,7 @@ cdef void f():
# f = j ** e # Cython prohibits this
i = e + g
f = h
i = ~a
i = -a
f()
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