Files
c3c/test/test_suite/generic/generic_num.c3t
2025-12-29 17:01:03 +01:00

36 lines
729 B
Plaintext

// #target: macos-x64
module hello{Type, FOO};
fn Type x(Type t)
{
return t * t + FOO;
}
module test;
import hello;
alias xint = hello::x{int, -123};
import std::io;
fn void main()
{
io::printfn("%d", xint(4));
}
/* #expect: test.ll
define void @test.main() #0 {
entry:
%varargslots = alloca [1 x %any], align 16
%taddr = alloca i32, align 4
%retparam = alloca i64, align 8
%0 = call i32 @"hello.x$int$_123$"(i32 4)
store i32 %0, ptr %taddr, align 4
%1 = insertvalue %any undef, ptr %taddr, 0
%2 = insertvalue %any %1, i64 ptrtoint (ptr @"$ct.int" to i64), 1
store %any %2, ptr %varargslots, align 16
%3 = call i64 @std.io.printfn(ptr %retparam, ptr @.str, i64 2, ptr %varargslots, i64 1)
ret void
}