mirror of
https://github.com/nim-lang/Nim.git
synced 2026-01-09 14:32:53 +00:00
fixes #23907
This commit is contained in:
@@ -894,7 +894,8 @@ proc p(n: PNode; c: var Con; s: var Scope; mode: ProcessMode; tmpFlags = {sfSing
|
||||
elif c.inSpawn > 0:
|
||||
c.inSpawn.dec
|
||||
|
||||
let parameters = n[0].typ
|
||||
# bug #23907; skips tyGenericInst for generic callbacks
|
||||
let parameters = if n[0].typ != nil: n[0].typ.skipTypes(abstractInst) else: n[0].typ
|
||||
let L = if parameters != nil: parameters.signatureLen else: 0
|
||||
|
||||
when false:
|
||||
|
||||
@@ -766,3 +766,26 @@ block: # bug #23524
|
||||
doAssert t2.a == 100
|
||||
|
||||
main()
|
||||
|
||||
block: # bug #23907
|
||||
type
|
||||
Thingy = object
|
||||
value: int
|
||||
|
||||
ExecProc[C] = proc(value: sink C): int {.nimcall.}
|
||||
|
||||
proc `=copy`(a: var Thingy, b: Thingy) {.error.}
|
||||
|
||||
var thingyDestroyCount = 0
|
||||
|
||||
proc `=destroy`(thingy: Thingy) =
|
||||
assert(thingyDestroyCount <= 0)
|
||||
thingyDestroyCount += 1
|
||||
|
||||
proc store(value: sink Thingy): int =
|
||||
result = value.value
|
||||
|
||||
let callback: ExecProc[Thingy] = store
|
||||
|
||||
doAssert callback(Thingy(value: 123)) == 123
|
||||
|
||||
|
||||
Reference in New Issue
Block a user