From 15540f0a3129c55647b986512f66003a073b7269 Mon Sep 17 00:00:00 2001 From: danielsan901998 Date: Thu, 2 Nov 2023 19:05:33 +0100 Subject: [PATCH] Parser: set kind to param in old style parameter declarations --- src/Parser.zig | 2 +- test/cases/functions.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Parser.zig b/src/Parser.zig index b44470c3..cc8ca820 100644 --- a/src/Parser.zig +++ b/src/Parser.zig @@ -987,7 +987,7 @@ fn decl(p: *Parser) Error!bool { const attr_buf_top_declarator = p.attr_buf.len; defer p.attr_buf.len = attr_buf_top_declarator; - var d = (try p.declarator(param_decl_spec.ty, .normal)) orelse { + var d = (try p.declarator(param_decl_spec.ty, .param)) orelse { try p.errTok(.missing_declaration, first_tok); _ = try p.expectToken(.semicolon); continue :param_loop; diff --git a/test/cases/functions.c b/test/cases/functions.c index 5c5bf049..fd979612 100644 --- a/test/cases/functions.c +++ b/test/cases/functions.c @@ -62,6 +62,10 @@ void unspecified_variable_len(int n, int x[][n]) { } static func_pointer p = unspecified_variable_len; +void static_array_parameter(x) + int x[static 5]; +{} + #define EXPECTED_ERRORS "functions.c:10:12: error: parameter named 'quux' is missing" \ "functions.c:20:14: error: illegal initializer (only variables can be initialized)" \