Breaking-Change: language
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
---
src/check.c | 2 ++
tests/34-declarations.ha | 5 +++++
2 files changed, 7 insertions(+)
diff --git a/src/check.c b/src/check.c
index dd91dd88..eecb4470 100644
--- a/src/check.c
+++ b/src/check.c
@@ -3867,6 +3867,8 @@ check_function(struct context *ctx,
}
if (afndecl->prototype.params) {
error(ctx, adecl->loc, NULL, "%s function cannot have parameters", flag);
+ } else if (obj->type->func.variadism != VARIADISM_NONE) {
+ error(ctx, adecl->loc, NULL, "%s function cannot be variadic", flag);
}
}
diff --git a/tests/34-declarations.ha b/tests/34-declarations.ha
index 8187d80f..d5b256f9 100644
--- a/tests/34-declarations.ha
+++ b/tests/34-declarations.ha
@@ -425,6 +425,11 @@ fn reject() void = {
"@fini fn f() void;",
"@test fn f() void;",
+ // @init/@fini/@test with C variadism
+ "@init fn f(...) void = void;",
+ "@fini fn f(...) void = void;",
+ "@test fn f(...) void = void;",
+
// @symbol alongside other attributes
`@symbol("foo") @init fn foo() void = void;`,
`@symbol("foo") @fini fn foo() void = void;`,
--
2.47.1