bloat-buster/tests/opaque.bbb
David Gonzalez Martin f90b527286
Some checks failed
CI / ci (MinSizeRel, ubuntu-latest) (push) Failing after 1m7s
CI / ci (Release, ubuntu-latest) (push) Failing after 1m5s
CI / ci (RelWithDebInfo, ubuntu-latest) (push) Failing after 1m8s
CI / ci (Debug, ubuntu-latest) (push) Failing after 2m30s
Forward declared type
2025-05-24 13:30:05 -06:00

17 lines
405 B
Plaintext

OpaqueType = opaque;
[extern] memcpy = fn [cc(c)] (destination: &s32, source: &s32, size: u64) &OpaqueType;
[export] main = fn [cc(c)] () s32
{
>destination: s32 = 1;
>source: s32 = 0;
>opaque_pointer = memcpy(&destination, &source, #byte_size(s32));
>pointer: &s32 = #pointer_cast(opaque_pointer);
if (pointer != &destination)
{
#trap();
}
return destination;
}