harec

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

commit 7482051e238d19ba5028c1b09860c459291eca85
parent 96092cb08b2f3b1867dfd9b38759523f35058c85
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue, 23 Feb 2021 14:21:12 -0500

Loosen up switch value restrictions

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

diff --git a/src/check.c b/src/check.c @@ -1913,9 +1913,10 @@ check_expr_switch(struct context *ctx, xcalloc(1, sizeof(struct expression)); check_expression(ctx, aopt->value, value, type); - // XXX: Should this be assignable instead? expect(&aopt->value->loc, - type == type_dealias(value->result), + type_is_assignable( + type_dealias(type), + type_dealias(value->result)), "Invalid type for switch case"); enum eval_result r = eval_expr(ctx, value, evaled);