aboutsummaryrefslogtreecommitdiff
path: root/decl.c
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2021-07-01 01:33:25 -0700
committerMichael Forney <mforney@mforney.org>2021-07-01 01:39:40 -0700
commitb2dc1102c3ae0976e9435f80df660b821742a2c8 (patch)
treef98346de4a27f007147e8d4deb7db7d82828a4cf /decl.c
parentbb682b0414d1f701610362ea3aaed89c6d43bda1 (diff)
decl: Check that struct/union has at least one member
Diffstat (limited to 'decl.c')
-rw-r--r--decl.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/decl.c b/decl.c
index ea62f56..d9e2a85 100644
--- a/decl.c
+++ b/decl.c
@@ -206,6 +206,8 @@ tagspec(struct scope *s)
b.bits = 0;
do structdecl(s, &b);
while (tok.kind != TRBRACE);
+ if (!t->structunion.members)
+ error(&tok.loc, "struct/union has no members");
next();
t->size = ALIGNUP(t->size, t->align);
t->incomplete = false;