diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index 8f7c93807f..2f50b7d1cf 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -2013,7 +2013,7 @@ proc genArrayConstr(c: PCtx, n: PNode, dest: var TDest) = c.gABx(n, opcLdNull, dest, c.genType(n.typ)) let intType = getSysType(c.graph, n.info, tyInt) - let seqType = n.typ.skipTypes(abstractVar-{tyTypeDesc}) + let seqType = n.typ.skipTypes(abstractVar+{tyStatic}-{tyTypeDesc}) if seqType.kind == tySequence: var tmp = c.getTemp(intType) c.gABx(n, opcLdImmInt, tmp, n.len) diff --git a/tests/vm/topenarrays.nim b/tests/vm/topenarrays.nim index 0a822f5831..10e724bd52 100644 --- a/tests/vm/topenarrays.nim +++ b/tests/vm/topenarrays.nim @@ -67,3 +67,12 @@ template fn= doAssert test([0,1,2,3,4,5]).id == 0 fn() # ok static: fn() + +block: # bug #24630 + func f(a: static openArray[int]): int = + 12 + + func g(a: static openArray[int]) = + const b = f(a) + + g(@[1,2,3])