aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2025-12-15 11:31:32 +0100
committerlemon <lsof@mailbox.org>2025-12-15 11:33:21 +0100
commit00f38f0fa0a5eb5414a43ded779bd4df3d9aa11a (patch)
treee3b81eea551f5a7a29bd153d79aedeba766d0992
parent068aaef0ea684ecf5f891559aa8e1dae03b8428d (diff)
c: error when defining function with incomplete parameter type
-rw-r--r--c/c.c4
1 files changed, 4 insertions, 0 deletions
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);