Skip to content

Commit 9c25934

Browse files
authored
consider proc return type as weak reference in codegen (#24894)
fixes #7706
1 parent 525d64f commit 9c25934

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

compiler/ccgtypes.nim

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -587,7 +587,7 @@ proc genProcParams(m: BModule; t: PType, rettype: var Rope, params: var Builder,
587587
if t.returnType == nil or isInvalidReturnType(m.config, t):
588588
rettype = CVoid
589589
else:
590-
rettype = getTypeDescAux(m, t.returnType, check, dkResult)
590+
rettype = getTypeDescWeak(m, t.returnType, check, dkResult)
591591
var paramBuilder: ProcParamBuilder
592592
params.addProcParams(paramBuilder):
593593
for i in 1..<t.n.len:

tests/proc/trecursivereturntype.nim

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# issue #7706
2+
3+
type
4+
Op = enum
5+
Halt
6+
Inc
7+
Dec
8+
9+
type
10+
InstrNext = proc (val: var int, code: seq[Op], pc: var int, stop: var bool): OpH {.inline, nimcall.}
11+
12+
OpH = object
13+
handler: InstrNext
14+
15+
var a: OpH

0 commit comments

Comments
 (0)