harec

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

commit 3a72092cb99f4e57fd6f5c2d7f3fd9af512c6c8c
parent 645c18098f2278fce099d7648e68d82607696300
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sat, 16 Jan 2021 11:38:59 -0500

check: dealias target for type assertions

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

diff --git a/src/check.c b/src/check.c @@ -452,12 +452,12 @@ check_expr_cast(struct context *ctx, "Invalid cast"); if (aexpr->cast.kind == C_ASSERTION || aexpr->cast.kind == C_TEST) { + const struct type *primary = type_dealias(expr->cast.value->result); expect(&aexpr->cast.value->loc, - type_dealias(expr->cast.value->result)->storage - == TYPE_STORAGE_TAGGED_UNION, + primary->storage == TYPE_STORAGE_TAGGED_UNION, "Expected a tagged union type"); bool found = false; - for (const struct type_tagged_union *t = &value->result->tagged; + for (const struct type_tagged_union *t = &primary->tagged; t; t = t->next) { if (t->type->id == secondary->id) { found = true;