Files
c3c/test/test_suite/functions/slice_escape.c3
Christoffer Lerno e605a21fd3 Revert "Revert 0.7.6 code for 0.7.5 re-release"
This reverts commit d1349c9cfb.
2025-09-05 23:30:35 +02:00

16 lines
355 B
Plaintext

fn int* test()
{
int[3] x = { 1, 2, 4 };
return (int[])&x; // #error: A pointer to a local variable will be invalid once the function returns. Allocate the data on the heap or temp memory to return a pointer
}
fn int main(String[] args)
{
MyArray a;
return 0;
}
struct MyArray
{
int[] val;
}
fn int* MyArray.get_ref(self, usz idx) => &self.val[idx];