Commit b03d34429d

Andrew Kelley <andrew@ziglang.org>
2023-07-17 08:17:45
compiler: work around slightly different generics semantics
Both of these cases are interesting, were not covered by behavior tests, and should be inspected carefully with regards to the language specification.
1 parent d15e8f8
Changed files (2)
src
codegen
src/codegen/c.zig
@@ -1802,7 +1802,12 @@ pub const DeclGen = struct {
         }
     }
 
-    fn writeCValueMember(dg: *DeclGen, writer: anytype, c_value: CValue, member: CValue) !void {
+    fn writeCValueMember(
+        dg: *DeclGen,
+        writer: anytype,
+        c_value: CValue,
+        member: CValue,
+    ) error{ OutOfMemory, AnalysisFail }!void {
         try dg.writeCValue(writer, c_value);
         try writer.writeByte('.');
         try dg.writeCValue(writer, member);
src/Zir.zig
@@ -65,9 +65,13 @@ pub const ExtraIndex = enum(u32) {
     _,
 };
 
+fn ExtraData(comptime T: type) type {
+    return struct { data: T, end: usize };
+}
+
 /// Returns the requested data, as well as the new index which is at the start of the
 /// trailers for the object.
-pub fn extraData(code: Zir, comptime T: type, index: usize) struct { data: T, end: usize } {
+pub fn extraData(code: Zir, comptime T: type, index: usize) ExtraData(T) {
     const fields = @typeInfo(T).Struct.fields;
     var i: usize = index;
     var result: T = undefined;