mirror of
https://github.com/ziglang/zig.git
synced 2026-01-10 01:15:14 +00:00
28 lines
667 B
Zig
28 lines
667 B
Zig
// TODO not passing
|
|
fn genericFnWithImplicitCast() {
|
|
@setFnTest(this);
|
|
|
|
assert(getFirstByte(u8, []u8 {13}) == 13);
|
|
assert(getFirstByte(u16, []u16 {0, 13}) == 0);
|
|
}
|
|
fn getByte(ptr: ?&u8) -> u8 {*??ptr}
|
|
fn getFirstByte(inline T: type, mem: []T) -> u8 {
|
|
getByte((&u8)(&mem[0]))
|
|
}
|
|
|
|
|
|
// TODO not passing
|
|
fn pointerToVoidReturnType() {
|
|
@setFnTest(this);
|
|
|
|
%%testPointerToVoidReturnType();
|
|
}
|
|
fn testPointerToVoidReturnType() -> %void {
|
|
const a = testPointerToVoidReturnType2();
|
|
return *a;
|
|
}
|
|
const test_pointer_to_void_return_type_x = void{};
|
|
fn testPointerToVoidReturnType2() -> &const void {
|
|
return &test_pointer_to_void_return_type_x;
|
|
}
|