c3c
c3c copied to clipboard
Casting a slice address to its pointer type should not compile
int[] array;
int* ptr = array; // This is ok
int* ptr = &array; // This should not compile (ptr has the address of the slice itself)
void* ptr = &array; // This is also weird and should probably not compile
For context: I introduced a bug by accidentally writing mem::free(&array) instead of mem::free(array) or mem::free(array.ptr).
The void* case is a bit bad, but hard to avoid. The bug is fixed.
Thanks.