parent
3ce27511ad
commit
3cbc80045d
3 changed files with 41 additions and 32 deletions
32
tests/ccgbugs/tlvalueconv.nim
Normal file
32
tests/ccgbugs/tlvalueconv.nim
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
discard """
|
||||
matrix: "--gc:refc; --gc:arc"
|
||||
"""
|
||||
|
||||
# bug #14160
|
||||
|
||||
type
|
||||
TPassContext = object of RootObj
|
||||
PPassContext = ref TPassContext
|
||||
|
||||
PCtx = ref object of TPassContext
|
||||
a: int
|
||||
|
||||
ModuleGraph = object
|
||||
vm: RootRef
|
||||
|
||||
proc main() =
|
||||
var g = ModuleGraph(vm: new(Pctx))
|
||||
PCtx(g.vm) = nil #This generates invalid C code
|
||||
doAssert g.vm == nil
|
||||
|
||||
main()
|
||||
|
||||
# bug #14325
|
||||
|
||||
proc main2() =
|
||||
var g = ModuleGraph(vm: new(Pctx))
|
||||
PPassContext(PCtx(g.vm)) = nil #This compiles, but crashes at runtime with gc:arc
|
||||
doAssert g.vm == nil
|
||||
|
||||
main2()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue