bloat-buster/tests/generic_pointer_macro.bbb
David Gonzalez Martin 88c187de46
All checks were successful
CI / ci (ReleaseFast, ubuntu-latest) (pull_request) Successful in 2m42s
CI / ci (ReleaseSmall, ubuntu-latest) (pull_request) Successful in 2m41s
CI / ci (ReleaseSafe, ubuntu-latest) (pull_request) Successful in 2m45s
CI / ci (Debug, ubuntu-latest) (pull_request) Successful in 4m12s
CI / ci (ReleaseFast, ubuntu-latest) (push) Successful in 2m40s
CI / ci (ReleaseSmall, ubuntu-latest) (push) Successful in 2m36s
CI / ci (ReleaseSafe, ubuntu-latest) (push) Successful in 2m42s
CI / ci (Debug, ubuntu-latest) (push) Successful in 4m8s
Constant global reference and proper type solving
2025-04-28 15:34:52 -06:00

26 lines
307 B
Plaintext

foo = macro [T] (ptr: &u32) &T
{
return #pointer_cast(ptr);
}
A = struct
{
a: u32,
}
B = struct
{
b: u32,
}
[export] main = fn [cc(c)] () s32
{
>var: u32 = 0;
>a = foo[A](&var);
>b = foo[B](&var);
a.a = 1;
if (b.b != 1) #trap();
if (var != 1) #trap();
return 0;
}