Skip to content

Commit d4438aa

Browse files
authored
Add @alignCast to downcast (#11)
1 parent ec243ce commit d4438aa

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main.zig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -644,7 +644,7 @@ pub const Interface = struct {
644644
/// if there's a mismatch. When this convention doesn't work, use @fieldParentPtr directly.
645645
pub fn downcast(comptime Implementer: type, interface_ref: anytype) *Implementer {
646646
const field_name = comptime std.meta.fieldNames(Implementer).*[0];
647-
return @fieldParentPtr(field_name, interface_ref);
647+
return @alignCast(@fieldParentPtr(field_name, interface_ref));
648648
}
649649

650650
/// Instantiates an interface type and populates its function pointers to point to

0 commit comments

Comments
 (0)