~mcf/cproc

ba938ae247c78838a942980dfcf9e6618a6ce610 — Michael Forney 2 years ago 8754499
init: Check for incomplete types

Fixes #28.
1 files changed, 4 insertions(+), 1 deletions(-)

M init.c
M init.c => init.c +4 -1
@@ 216,11 216,14 @@ parseinit(struct scope *s, struct type *t)
	struct expression *expr;
	struct type *base;

	t = typeunqual(t, NULL);
	p.cur = NULL;
	p.sub = p.obj;
	p.sub->offset = 0;
	p.sub->type = typeunqual(t, NULL);
	p.sub->type = t;
	p.sub->iscur = false;
	if (t->incomplete && !(t->kind == TYPEARRAY && t->array.length == 0))
		error(&tok.loc, "initializer specified for incomplete type");
	for (;;) {
		if (p.cur) {
			if (tok.kind == TLBRACK || tok.kind == TPERIOD)