harec

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 97c7bb1e245e94b812f2e6feba2e1fa8f05aab40
parent dd73e7df284e61e2fb1e371210dbe5956db84bcb
Author: Drew DeVault <sir@cmpwn.com>
Date:   Thu,  9 Dec 2021 13:43:20 +0100

check: loosen restrictions on struct initializers

Signed-off-by: Drew DeVault <sir@cmpwn.com>

Diffstat:
Msrc/check.c | 5+++--
1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/check.c b/src/check.c @@ -2361,9 +2361,10 @@ check_expr_struct(struct context *ctx, return; } stype = obj->type; - if (type_dealias(stype)->storage != STORAGE_STRUCT) { + enum type_storage storage = type_dealias(stype)->storage; + if (storage != STORAGE_STRUCT && storage != STORAGE_UNION) { error(ctx, aexpr->loc, expr, - "Object named is not a struct type"); + "Object named is not a struct or union type"); return; } }