Skip to content

Commit 2a68fa7

Browse files
ringaboutnarimiran
authored andcommitted
fix #19680; check if stderr is static (#19709)
(cherry picked from commit 26bcf18)
1 parent fcd05bd commit 2a68fa7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

compiler/vmgen.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1497,7 +1497,7 @@ proc checkCanEval(c: PCtx; n: PNode) =
14971497
# proc foo() = var x ...
14981498
let s = n.sym
14991499
if {sfCompileTime, sfGlobal} <= s.flags: return
1500-
if s.importcCondVar: return
1500+
if compiletimeFFI in c.config.features and s.importcCondVar: return
15011501
if s.kind in {skVar, skTemp, skLet, skParam, skResult} and
15021502
not s.isOwnedBy(c.prc.sym) and s.owner != c.module and c.mode != emRepl:
15031503
# little hack ahead for bug #12612: assume gensym'ed variables

tests/misc/tvarious1.nim

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,13 @@ echo value
4646
var ys = @[4.1, 5.6, 7.2, 1.7, 9.3, 4.4, 3.2]
4747
#var x = int(ys.high / 2) #echo ys[x] # Works
4848
echo ys[int(ys.high / 2)] # Doesn't work
49+
50+
51+
# bug #19680
52+
var here = ""
53+
when stderr is static:
54+
doAssert false
55+
else:
56+
here = "works"
57+
58+
doAssert here == "works"

0 commit comments

Comments
 (0)