Sema: fix empty slice pointer value

We just checked that inst_child_ty was effectively a zero-bit type, so
it is certainly not the non-zero alignment we are looking for.

Closes #15085
This commit is contained in:
Jacob Young
2023-03-27 06:55:48 -04:00
committed by Veikka Tuominen
parent 2b80552603
commit dd66e0addb
4 changed files with 20 additions and 7 deletions
+1 -1
View File
@@ -1069,7 +1069,7 @@ pub const DeclGen = struct {
const extern_fn = val.castTag(.extern_fn).?.data;
try dg.renderDeclName(writer, extern_fn.owner_decl, 0);
},
.int_u64, .one => {
.int_u64, .one, .int_big_positive, .lazy_align, .lazy_size => {
try writer.writeAll("((");
try dg.renderType(writer, ty);
return writer.print("){x})", .{try dg.fmtIntLiteral(Type.usize, val, .Other)});
+1 -1
View File
@@ -3397,7 +3397,7 @@ pub const DeclGen = struct {
};
return dg.context.constStruct(&fields, fields.len, .False);
},
.int_u64, .one, .int_big_positive => {
.int_u64, .one, .int_big_positive, .lazy_align, .lazy_size => {
const llvm_usize = try dg.lowerType(Type.usize);
const llvm_int = llvm_usize.constInt(tv.val.toUnsignedInt(target), .False);
return llvm_int.constIntToPtr(try dg.lowerType(tv.ty));