From 6d4fff31616fdc96da20898d39d7cba95a9cda0a Mon Sep 17 00:00:00 2001 From: Teddy Date: Sun, 6 Apr 2014 15:56:26 +0800 Subject: bugfix: global incomplete type should not be allowed --- semantics.c | 2 +- semantics.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/semantics.c b/semantics.c index 39ca0c1..1d9e329 100644 --- a/semantics.c +++ b/semantics.c @@ -596,7 +596,7 @@ CVar_t semantics_decl(CNode *p, CScope_t scope) { { /* TODO: initializer checking */ CVar_t var = semantics_declr(p->chd, type, scope, 0); - if (scope->lvl && !type_is_complete(var->type)) + if (!type_is_complete(var->type)) { sprintf(err_buff, "storage size of '%s' isn’t known", var->name); ERROR(var->ast); diff --git a/semantics.h b/semantics.h index aed73de..df7f36a 100644 --- a/semantics.h +++ b/semantics.h @@ -7,7 +7,7 @@ struct CTable; typedef struct CTable *CTable_t; struct CType; -typedef struct CVar{ +typedef struct CVar { const char *name; struct CVar *next; /* next in the linked list */ struct CType *type; -- cgit v1.2.3-70-g09d2