mirror of
https://github.com/ziglang/zig.git
synced 2025-12-27 16:43:07 +00:00
15 lines
282 B
Zig
15 lines
282 B
Zig
const testing = @import("std").testing;
|
|
const builtin = @import("builtin");
|
|
|
|
test {
|
|
try testing.expect(getGeneric(u8, getU8) == 123);
|
|
}
|
|
|
|
fn getU8() callconv(.C) u8 {
|
|
return 123;
|
|
}
|
|
|
|
fn getGeneric(comptime T: type, supplier: fn () callconv(.C) T) T {
|
|
return supplier();
|
|
}
|