harec

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

commit bbaf1bf827a0d8042146eda67434e8eb5966521a
parent 700c8a23413f6912baf026c09582a043eaf19c2d
Author: Eyal Sawady <ecs@d2evs.net>
Date:   Wed, 23 Mar 2022 14:28:32 +0000

promote_const: fix ambiguous tagged union case

Implements the spec changes from
93b92186ba6340035d612dacb065cb9e9bd49466. Essentially, fall back to the
default type for ambiguous tagged unions in all promotions rather than
only for literals with type hints.

Signed-off-by: Eyal Sawady <ecs@d2evs.net>

Diffstat:
Msrc/types.c | 4++++
1 file changed, 4 insertions(+), 0 deletions(-)

diff --git a/src/types.c b/src/types.c @@ -631,6 +631,10 @@ promote_const(const struct type *a, const struct type *b) { } if (tag) { // Ambiguous + b = lower_const(b, NULL); + if (type_is_assignable(a, b)) { + return b; + } return NULL; } tag = p;