diff options
author | Michael Forney <mforney@mforney.org> | 2024-04-27 15:06:32 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2024-04-27 15:34:27 -0700 |
commit | f66a661359a39e10af01508ad02429517b8460e3 (patch) | |
tree | bfc5ffdc688f02d8c36416bcfef2ce2727c5443f /eval.c | |
parent | 4f206ac1ea1b20400fa242f2f3be86237c4ba3bf (diff) |
Store enum constant value in struct decl
Diffstat (limited to 'eval.c')
-rw-r--r-- | eval.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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) |