This commit is contained in:
agra
2026-03-05 16:20:36 +02:00
parent 22bc2439ce
commit f9dda972d2
36 changed files with 1063 additions and 7 deletions

23
examples/issue-0009.sx Normal file
View File

@@ -0,0 +1,23 @@
// issue-0009: `push` with Context containing inline protocol triggers LLVM verification error
//
// LLVM verification failed: Invalid InsertValueInst operands!
// %si24 = insertvalue { ptr, ptr, ptr } undef, { ptr, ptr, ptr } %si21, 0
//
// Context contains `allocator: Allocator` where `Allocator :: protocol #inline`.
// push saves/restores context as a value, but LLVM lowering mishandles the struct
// when the first field is an inline protocol cast from a different impl (Arena).
#import "modules/std.sx";
#import "modules/allocators.sx";
main :: () -> void {
arena : Arena = ---;
arena.create(context.allocator, 4096);
new_ctx := Context.{ allocator = xx @arena, data = context.data };
push new_ctx {
ptr := context.allocator.alloc(128);
out("inside push\n");
}
out("after push\n");
}