summaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 48534d6..bbefde5 100644
--- a/eval.c
+++ b/eval.c
@@ -74,6 +74,11 @@ static bool eval_expr_as_int(Expression *e, Integer *i) {
return false;
}
Declaration *d = id_decl->decl;
+ if (is_after(d->where, e->where)) {
+ err_print(e->where, "Use of constant before its declaration.");
+ info_print(d->where, "Declaration will be here.");
+ return false;
+ }
if (!(d->flags & DECL_FLAG_CONST)) {
err_print(e->where, "Use of non-constant identifier in a constant expression.");
info_print(d->where, "Declaration was here.");