Open helehex opened 2 months ago
More of an issue with UnsafePointer[UnsafePointer[...]]
in general though:
fn init() -> UnsafePointer[UnsafePointer[Int]]:
var ptr = UnsafePointer[Int].alloc(1)
ptr[] = 5
var ptrptr = UnsafePointer[UnsafePointer[Int]].alloc(1)
ptrptr[] = ptr
return ptrptr
fn main():
alias p = init()
alias entry = p[][] # prints nonsense
# var entry = p[][] # prints 5
print(entry)
Seems like the same root cause of an issue I raised as well https://github.com/modularml/mojo/issues/3285
Bug description
I also tried with
VariadicList
, andInlineArray
. Both of those work fine. If you usevar entry = ll[1][1]
instead ofalias entry = ll[1][1]
, it works. (see example)Steps to reproduce
System information