commit 1ef711c09431043fad0f27e1bd86c07d0afc4e01
parent 223e8235a93e86b6047a4a3d1f1bf253b2f534f8
Author: Ember Sawady <ecs@d2evs.net>
Date: Wed, 14 Sep 2022 17:39:37 +0000
Fix casting of rconst to void
Signed-off-by: Ember Sawady <ecs@d2evs.net>
Diffstat:
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/check.c b/src/check.c
@@ -1445,7 +1445,7 @@ check_expr_cast(struct context *ctx,
free(secondarytypename);
return;
}
- if (primary->storage == STORAGE_RCONST) {
+ if (value->result->storage == STORAGE_RCONST) {
uint32_t max = 0;
switch (secondary->storage) {
case STORAGE_RUNE:
diff --git a/src/types.c b/src/types.c
@@ -889,6 +889,9 @@ bool
type_is_castable(const struct type *to, const struct type *from)
{
if (to->storage == STORAGE_VOID) {
+ if (type_is_constant(from)) {
+ lower_const(from, NULL);
+ };
return true;
}