aboutsummaryrefslogtreecommitdiff
path: root/expr.c
diff options
context:
space:
mode:
Diffstat (limited to 'expr.c')
-rw-r--r--expr.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/expr.c b/expr.c
index 099c3e8..a824873 100644
--- a/expr.c
+++ b/expr.c
@@ -820,12 +820,18 @@ condexpr(struct scope *s)
return e;
}
+struct expr *
+constexpr(struct scope *s)
+{
+ return eval(condexpr(s));
+}
+
uint64_t
intconstexpr(struct scope *s, bool allowneg)
{
struct expr *e;
- e = eval(condexpr(s));
+ e = constexpr(s);
if (e->kind != EXPRCONST || !(typeprop(e->type) & PROPINT))
error(&tok.loc, "not an integer constant expression");
if (!allowneg && e->type->basic.issigned && e->constant.i > INT64_MAX)