Commit 572ec10d authored by Xavier Thompson's avatar Xavier Thompson

Let the truth value of cypclass objects fall back on the value of their pointer

parent e5a59ad5
......@@ -1167,6 +1167,11 @@ class ExprNode(Node):
elif type.is_pyobject or type.is_int or type.is_ptr or type.is_float:
return CoerceToBooleanNode(self, env)
elif type.is_cpp_class:
if type.is_cyp_class:
has_bool_operator = type.scope.lookup_here("operator bool")
# let cypclass truth-testing fall back on the value of the pointer
if not has_bool_operator:
return CoerceToBooleanNode(self, env)
return SimpleCallNode(
self.pos,
function=AttributeNode(
......
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