type
      VALUE = object
        d: uint32
    #proc init(v: var VALUE) = # working code
    #  v.d = 3
    
    proc init(v: var VALUE | ptr VALUE) =
      when v is ptr VALUE:
        v[].d = 1
      else:
        v.d = 2  # compile error
    
    var v: VALUE
    v.init()
    echo repr v
    
    
    Run
    
    
    testRepr.nim(28, 2) template/generic instantiation of `init` from here
    testRepr.nim(25, 6) Error: 'v.d' cannot be assigned to

This is my mistake or compiler?

Reply via email to