parent
9fd67958b9
commit
fb60e35a54
1 changed files with 18 additions and 0 deletions
18
tests/overload/t8829.nim
Normal file
18
tests/overload/t8829.nim
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
block:
|
||||||
|
let txt = "Hello World"
|
||||||
|
|
||||||
|
template `[]`[T](p: ptr T, span: Slice[int]): untyped =
|
||||||
|
toOpenArray(cast[ptr array[0, T]](p)[], span.a, span.b)
|
||||||
|
|
||||||
|
doAssert $cast[ptr uint8](txt[0].unsafeAddr)[0 ..< txt.len] ==
|
||||||
|
"[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]"
|
||||||
|
|
||||||
|
|
||||||
|
block:
|
||||||
|
let txt = "Hello World"
|
||||||
|
|
||||||
|
template `[]`[T](p: ptr T, span: Slice[int]): untyped =
|
||||||
|
toOpenArray(cast[ptr array[0, T]](p)[], span.a, span.b)
|
||||||
|
|
||||||
|
doAssert $cast[ptr uint8](txt[0].unsafeAddr)[0 ..< txt.len] ==
|
||||||
|
"[72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100]"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue