diff options
| author | xdBronch <51252236+xdBronch@users.noreply.github.com> | 2025-01-13 00:28:53 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-01-13 05:28:53 +0000 |
| commit | fb43e91b226a9cde51967455c57989c0371d4b0a (patch) | |
| tree | c411f5cbbbf9b162dd3bdc8b4b494145cc91cca7 /src | |
| parent | 5de880c288b0f340b57442d68685c79cf515fc78 (diff) | |
| download | zig-fb43e91b226a9cde51967455c57989c0371d4b0a.tar.gz zig-fb43e91b226a9cde51967455c57989c0371d4b0a.zip | |
Sema: disallow non scalar sentinels in array types and reified types (#22473)
Diffstat (limited to 'src')
| -rw-r--r-- | src/Sema.zig | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index c0c02bae58..403d844b7e 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -8423,6 +8423,7 @@ fn zirArrayTypeSentinel(sema: *Sema, block: *Block, inst: Zir.Inst.Index) Compil .sentinel = sentinel_val.toIntern(), .child = elem_type.toIntern(), }); + try sema.checkSentinelType(block, sentinel_src, elem_type); return Air.internedToRef(array_ty.toIntern()); } @@ -21650,6 +21651,7 @@ fn zirReify( const sentinel_ptr_val = sentinel_val.optionalValue(zcu).?; const ptr_ty = try pt.singleMutPtrType(elem_ty); const sent_val = (try sema.pointerDeref(block, src, sentinel_ptr_val, ptr_ty)).?; + try sema.checkSentinelType(block, src, elem_ty); break :s sent_val.toIntern(); } break :s .none; @@ -21714,6 +21716,7 @@ fn zirReify( const child_ty = child_val.toType(); const sentinel = if (sentinel_val.optionalValue(zcu)) |p| blk: { const ptr_ty = try pt.singleMutPtrType(child_ty); + try sema.checkSentinelType(block, src, child_ty); break :blk (try sema.pointerDeref(block, src, p, ptr_ty)).?; } else null; |
