aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-09-20 16:48:42 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-09-20 16:48:42 -0700
commitabc30f79489b68f6dc0ee4b408c63a8e783215d1 (patch)
tree0979982ebfa529405ae0e6014f910a3cf496aa14 /src/Sema.zig
parent4b2d7a9c67760aa9a81bfd364ac0d88cbb9737f1 (diff)
downloadzig-abc30f79489b68f6dc0ee4b408c63a8e783215d1.tar.gz
zig-abc30f79489b68f6dc0ee4b408c63a8e783215d1.zip
stage2: improve handling of 0 bit types
* Sema: zirAtomicLoad handles 0-bit types correctly * LLVM backend: when lowering function types, elide parameters with 0-bit types. * Type: abiSize handles u0/i0 correctly
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index f53dbea90c..990aa4ddf0 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -7803,6 +7803,10 @@ fn zirAtomicLoad(sema: *Sema, block: *Scope.Block, inst: Zir.Inst.Index) Compile
else => {},
}
+ if (try sema.typeHasOnePossibleValue(block, elem_ty_src, elem_ty)) |val| {
+ return sema.addConstant(elem_ty, val);
+ }
+
if (try sema.resolveDefinedValue(block, ptr_src, ptr)) |ptr_val| {
if (try ptr_val.pointerDeref(sema.arena)) |elem_val| {
return sema.addConstant(elem_ty, elem_val);