aboutsummaryrefslogtreecommitdiff
path: root/src/check_expr.cpp
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-09-25 23:08:22 +0100
committerGinger Bill <bill@gingerbill.org>2017-09-25 23:08:22 +0100
commit793bc8c58580dfb64d7c31ca992c34b38e9847e7 (patch)
treeca8150dfcdd0fb993cf6675672213b56239a244a /src/check_expr.cpp
parent335e88b738ef7decbf48af8d62cca2c9d0167baf (diff)
Fix issue #89
Diffstat (limited to 'src/check_expr.cpp')
-rw-r--r--src/check_expr.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/check_expr.cpp b/src/check_expr.cpp
index 9357ebc61..bec444d2f 100644
--- a/src/check_expr.cpp
+++ b/src/check_expr.cpp
@@ -87,7 +87,12 @@ void error_operand_not_expression(Operand *o) {
void error_operand_no_value(Operand *o) {
if (o->mode == Addressing_NoValue) {
gbString err = expr_to_string(o->expr);
- error(o->expr, "`%s` used as value", err);
+ AstNode *x = unparen_expr(o->expr);
+ if (x->kind == AstNode_CallExpr) {
+ error(o->expr, "`%s` call does not return a value and cannot be used as a value", err);
+ } else {
+ error(o->expr, "`%s` used as a value", err);
+ }
gb_string_free(err);
o->mode = Addressing_Invalid;
}