diff options
| author | g-w1 <58830309+g-w1@users.noreply.github.com> | 2020-12-22 17:05:42 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-12-23 00:05:42 +0200 |
| commit | ea18f894f524fdc82dc09ea9c6abf8feb93b04e8 (patch) | |
| tree | f909625161a772e6fff87fd776f5ede1a1a97325 /src | |
| parent | 03113d92467a99658c2606a21821b28b19dfdded (diff) | |
| download | zig-ea18f894f524fdc82dc09ea9c6abf8feb93b04e8.tar.gz zig-ea18f894f524fdc82dc09ea9c6abf8feb93b04e8.zip | |
Peer type resolution with unsigned ints and larger signed ints
Diffstat (limited to 'src')
| -rw-r--r-- | src/stage1/ir.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/src/stage1/ir.cpp b/src/stage1/ir.cpp index 9278ee7564..864f2615f9 100644 --- a/src/stage1/ir.cpp +++ b/src/stage1/ir.cpp @@ -12706,11 +12706,13 @@ static ZigType *ir_resolve_peer_types(IrAnalyze *ira, AstNode *source_node, ZigT } if (prev_type->id == ZigTypeIdInt && - cur_type->id == ZigTypeIdInt && - prev_type->data.integral.is_signed == cur_type->data.integral.is_signed) + cur_type->id == ZigTypeIdInt) { - if (cur_type->data.integral.bit_count > prev_type->data.integral.bit_count) { - prev_inst = cur_inst; + if ((prev_type->data.integral.is_signed == cur_type->data.integral.is_signed) || + (cur_type->data.integral.is_signed && !prev_type->data.integral.is_signed)) { + if (cur_type->data.integral.bit_count > prev_type->data.integral.bit_count) { + prev_inst = cur_inst; + } } continue; } |
