summary refs log tree commit diff stats
path: root/tests/arc/t18977.nim
blob: c775551a46d345bb546499b6017d55b8c12e5b4a (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
26
discard """
  matrix: "--mm:arc"
"""

type
  E = enum
    a, b, c, d
  X = object
    v: int
  O = object
    case kind: E
    of a:
      a: int
    of {b, c}:
      b: float
    else:
      d: X

proc `=destroy`(x: var X) =
  echo "x destroyed"

var o = O(kind: d, d: X(v: 12345))
doAssert o.d.v == 12345

doAssertRaises(FieldDefect):
  o.kind = a