From 00f38f0fa0a5eb5414a43ded779bd4df3d9aa11a Mon Sep 17 00:00:00 2001 From: lemon Date: Mon, 15 Dec 2025 11:31:32 +0100 Subject: c: error when defining function with incomplete parameter type --- c/c.c | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'c/c.c') diff --git a/c/c.c b/c/c.c index 594f38d..d7ef539 100644 --- a/c/c.c +++ b/c/c.c @@ -4396,6 +4396,10 @@ docomp(struct comp *cm) fn.fnty = decl.ty; if (td->ret.t != TYVOID && isincomplete(td->ret)) error(&decl.span, "function definition with incomplete return type '%ty'", td->ret); + for (int i = 0; i < td->nmemb; ++i) { + if (td->param[i].t != TYVOID && isincomplete(td->param[i])) + error(&st.pspans[i], "parameter has incomplete type '%ty'", td->param[i]); + } fn.retty = td->ret; decl.isdef = 1; putdecl(cm, &decl); -- cgit v1.2.3