diff --git a/compiler/vmgen.nim b/compiler/vmgen.nim index d3d216fde5..0db0e93f9f 100644 --- a/compiler/vmgen.nim +++ b/compiler/vmgen.nim @@ -2040,7 +2040,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 375d2523d3..472f902103 100644 --- a/tests/vm/topenarrays.nim +++ b/tests/vm/topenarrays.nim @@ -87,3 +87,12 @@ block: # bug #22095 z = fn() doAssert z.limbs[0] == 10 + +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])