aboutsummaryrefslogtreecommitdiff
path: root/eval.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2024-04-27 15:06:32 -0700
committerMichael Forney <mforney@mforney.org>2024-04-27 15:34:27 -0700
commitf66a661359a39e10af01508ad02429517b8460e3 (patch)
treebfc5ffdc688f02d8c36416bcfef2ce2727c5443f /eval.c
parent4f206ac1ea1b20400fa242f2f3be86237c4ba3bf (diff)
Store enum constant value in struct decl
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/eval.c b/eval.c
index 7b3a576..98f5ec9 100644
--- a/eval.c
+++ b/eval.c
@@ -110,10 +110,11 @@ eval(struct expr *expr)
t = expr->type;
switch (expr->kind) {
case EXPRIDENT:
- if (expr->u.ident.decl->kind != DECLCONST)
+ d = expr->u.ident.decl;
+ if (d->kind != DECLCONST)
break;
expr->kind = EXPRCONST;
- expr->u.constant.u = intconstvalue(expr->u.ident.decl->value);
+ expr->u.constant.u = d->u.enumconst;
break;
case EXPRCOMPOUND:
if (expr->u.compound.decl->u.obj.storage != SDSTATIC)