From b56dffd9a7f810dbbf264cd4060e6160556bd02c Mon Sep 17 00:00:00 2001 From: Thomas Voss Date: Sat, 22 Jun 2024 22:57:40 +0200 Subject: Default untyped numeric constants to ints --- src/analyzer.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/analyzer.c b/src/analyzer.c index f665d4c..b16a2eb 100644 --- a/src/analyzer.c +++ b/src/analyzer.c @@ -215,9 +215,11 @@ analyzedecl(struct azctx ctx, scope_t *scps, type_t *types, ast_t ast, } else ni = fwdnode(ast, i); - if (ltype.kind == TYPE_UNSET) + if (ltype.kind == TYPE_UNSET) { ltype = rtype; - else if (!typecompat(ltype, rtype)) + if (ast.kinds[i] == ASTDECL && rtype.size == 0) + ltype.size = 8; + } else if (!typecompat(ltype, rtype)) err("analyzer: Type mismatch"); types[i] = ltype; -- cgit v1.2.3