diff options
| author | xdBronch <51252236+xdBronch@users.noreply.github.com> | 2025-03-09 23:03:06 -0400 |
|---|---|---|
| committer | Matthew Lugg <mlugg@mlugg.co.uk> | 2025-04-28 05:09:12 +0100 |
| commit | 410298271eae2535e39a9de433afc8159704e7c6 (patch) | |
| tree | a98ab5298b927af1933654893396e57827fc19c6 /src/Sema.zig | |
| parent | 78df3c9301891a3333eb5420074c9b0d56d54a54 (diff) | |
| download | zig-410298271eae2535e39a9de433afc8159704e7c6.tar.gz zig-410298271eae2535e39a9de433afc8159704e7c6.zip | |
Sema: fix memcpy with C pointers
Diffstat (limited to 'src/Sema.zig')
| -rw-r--r-- | src/Sema.zig | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Sema.zig b/src/Sema.zig index 5c084cd4b6..ef26d5a9dd 100644 --- a/src/Sema.zig +++ b/src/Sema.zig @@ -3668,7 +3668,10 @@ fn indexablePtrLenOrNone( const zcu = pt.zcu; const operand_ty = sema.typeOf(operand); try checkMemOperand(sema, block, src, operand_ty); - if (operand_ty.ptrSize(zcu) == .many) return .none; + switch (operand_ty.ptrSize(zcu)) { + .many, .c => return .none, + .one, .slice => {}, + } const field_name = try zcu.intern_pool.getOrPutString(sema.gpa, pt.tid, "len", .no_embedded_nulls); return sema.fieldVal(block, src, operand, field_name, src); } |
