summary refs log blame commit diff stats
path: root/tests/objvariant/tadrdisc.nim
blob: 0e0324562ff875ece0c5bda0d452cdacb179d6d2 (plain) (tree)
1
2
3
4
5




                                                              















                                                                      

 
discard """
  file: "tadrdisc.nim"
  line: 20
  errormsg: "for a \'var\' type a variable needs to be passed"
"""
# Test that the address of a dicriminants cannot be taken

type
  TKind = enum ka, kb, kc
  TA = object
    case k: TKind
    of ka: x, y: int
    of kb: a, b: string
    of kc: c, d: float
    
proc setKind(k: var TKind) = 
  k = kc
  
var a: TA
setKind(a.k) #ERROR_MSG for a 'var' type a variable needs to be passed