summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-06-15 19:14:49 -0400
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-06-16 21:11:01 -0400
commit7420436ca19f76ab636c26b8ecc899224ca44820 (patch)
treea91f9b7370ea2363e37de120b1525331e36ad291
parent67c267a93a1c019e0506bfe16cbad5d06a53eb28 (diff)
Allow non-void function references to be assigned to void function variables
-rw-r--r--interpret.c2
-rw-r--r--type-check.c7
2 files changed, 5 insertions, 4 deletions
diff --git a/interpret.c b/interpret.c
index d5b261d..defb194 100644
--- a/interpret.c
+++ b/interpret.c
@@ -496,4 +496,6 @@ interpret (ast_t *ast)
current = next;
}
+
+ g_assert (stack->a->len == 0);
}
diff --git a/type-check.c b/type-check.c
index fc1d149..f200d1a 100644
--- a/type-check.c
+++ b/type-check.c
@@ -153,11 +153,10 @@ compatible_functions (ast_function_type_spec_t *left,
return report_error ("Incompatible argument types\n");
}
- if ((is_void (left->return_) && !is_void (right->return_)) ||
- (is_void (right->return_) && !is_void (left->return_)))
+ if (!assignable (left->return_, right->return_) &&
+ !is_void (left->return_))
{
- return report_error ("Void and non-void functions "
- "are not compatible\n");
+ return FALSE;
}
return TRUE;