mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
consider proc return type as weak reference in codegen (#24894)
fixes #7706
(cherry picked from commit 9c2593444a)
This commit is contained in:
@@ -597,7 +597,7 @@ proc genProcParams(m: BModule; t: PType, rettype, params: var Rope,
|
||||
if t.returnType == nil or isInvalidReturnType(m.config, t):
|
||||
rettype = "void"
|
||||
else:
|
||||
rettype = getTypeDescAux(m, t.returnType, check, dkResult)
|
||||
rettype = getTypeDescWeak(m, t.returnType, check, dkResult)
|
||||
for i in 1..<t.n.len:
|
||||
if t.n[i].kind != nkSym: internalError(m.config, t.n.info, "genProcParams")
|
||||
var param = t.n[i].sym
|
||||
|
||||
15
tests/proc/trecursivereturntype.nim
Normal file
15
tests/proc/trecursivereturntype.nim
Normal file
@@ -0,0 +1,15 @@
|
||||
# issue #7706
|
||||
|
||||
type
|
||||
Op = enum
|
||||
Halt
|
||||
Inc
|
||||
Dec
|
||||
|
||||
type
|
||||
InstrNext = proc (val: var int, code: seq[Op], pc: var int, stop: var bool): OpH {.inline, nimcall.}
|
||||
|
||||
OpH = object
|
||||
handler: InstrNext
|
||||
|
||||
var a: OpH
|
||||
Reference in New Issue
Block a user