mirror of
https://github.com/ziglang/zig.git
synced 2026-01-04 12:33:19 +00:00
parent
0fa80e66b7
commit
37afab2add
@ -26005,6 +26005,7 @@ fn analyzeDeclRef(sema: *Sema, decl_index: Decl.Index) CompileError!Air.Inst.Ref
|
||||
.pointee_type = decl_tv.ty,
|
||||
.mutable = false,
|
||||
.@"addrspace" = decl.@"addrspace",
|
||||
.@"align" = decl.@"align",
|
||||
}),
|
||||
try Value.Tag.decl_ref.create(sema.arena, decl_index),
|
||||
);
|
||||
|
||||
@ -486,3 +486,14 @@ test "array slicing to slice" {
|
||||
try S.doTheTest();
|
||||
comptime try S.doTheTest();
|
||||
}
|
||||
|
||||
test "pointer to constant decl preserves alignment" {
|
||||
const S = struct {
|
||||
a: u8,
|
||||
b: u8,
|
||||
const aligned align(8) = @This(){ .a = 3, .b = 4 };
|
||||
};
|
||||
|
||||
const alignment = @typeInfo(@TypeOf(&S.aligned)).Pointer.alignment;
|
||||
try std.testing.expect(alignment == 8);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user