commit 53d135c28b364c527a570d0c88608182a209f9dc
parent f9367d93b76faa4de2558027456d58179dacf8d2
Author: Alexey Yerin <yyp@disroot.org>
Date: Sun, 30 Jan 2022 21:04:15 +0300
check: disallow 'case let' of zero or undefined size
Signed-off-by: Alexey Yerin <yyp@disroot.org>
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/check.c b/src/check.c
@@ -1904,6 +1904,11 @@ check_expr_match(struct context *ctx,
if (acase->name) {
assert(ctype);
+ if (ctype->size == 0 || ctype->size == SIZE_UNDEFINED) {
+ error(ctx, acase->type->loc, expr,
+ "Cannot create binding for type of zero or undefined size");
+ return;
+ }
struct identifier ident = {
.name = acase->name,
};