From f4c9eb17741190ee73d4f2e9f3df3485581e8371 Mon Sep 17 00:00:00 2001 From: cooldome Date: Thu, 9 May 2019 15:45:56 +0100 Subject: [PATCH] fixes #11204 (#11207) --- compiler/injectdestructors.nim | 1 + tests/destructor/tv2_cast.nim | 5 +++++ 2 files changed, 6 insertions(+) diff --git a/compiler/injectdestructors.nim b/compiler/injectdestructors.nim index 0111bd4afd..db2d9a4f2c 100644 --- a/compiler/injectdestructors.nim +++ b/compiler/injectdestructors.nim @@ -733,6 +733,7 @@ proc p(n: PNode; c: var Con): PNode = for j in 0..L-3: let v = it[j] if v.kind == nkSym: + if sfCompileTime in v.sym.flags: continue # move the variable declaration to the top of the frame: c.addTopVar v # make sure it's destroyed at the end of the proc: diff --git a/tests/destructor/tv2_cast.nim b/tests/destructor/tv2_cast.nim index 82c03fb174..8a4d69ef0b 100644 --- a/tests/destructor/tv2_cast.nim +++ b/tests/destructor/tv2_cast.nim @@ -17,3 +17,8 @@ echo cast[string](@[116'u8, 101, 115, 116]) var a = cast[seq[uint32]]("test1234") a.setLen(2) echo a + + +#issue 11204 +var ac {.compileTime.} = @["a", "b"] +const bc = ac.len \ No newline at end of file