summary refs log tree commit diff stats
path: root/tests/ccgbugs/tmissingderef2.nim
blob: 59cd24dd169410fe08e7485f63a33cb195ca5b14 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
discard """
  output: "c"
"""

# bug #5079

import tables, strutils

type Test = ref object
  s: string

proc `test=`(t: Test, s: string) =
  t.s = s

var t = Test()

#t.test = spaces(2) # -- works

var a = newTable[string, string]()
a["b"] = "c"

#t.s = a["b"] # -- works
#t.test a["b"] # -- works
t.test = a["b"] # -- prints "out of memory" and quits
echo t.s