Compiling the following code
    
    
    type
      Obj*[T] = object
        case a*: bool
        of false: discard
        of true:
          b*: seq[T]
    
    var obj = Obj[void](a: false)
    
    
    Run

Fails in
    
    
    ~/test/a.nim(8, 20) template/generic instantiation of `setLen` from here
    ~/.choosenim/toolchains/nim-2.0.0/lib/system/seqs_v2.nim(126, 18) 
template/generic instantiation of `len` from here
    ~/.choosenim/toolchains/nim-2.0.0/lib/system.nim(711, 13) Error: invalid 
type: 'void' in this context: 'proc (x: seq[void]): int{.noSideEffect, 
gcsafe.}' for proc
    
    
    
    Run

I think this happens because even though the `true` branch isn't used it tries 
to see if it's valid, and a sequence of `void` isn't valid.

A quick fix is to change `void` to any other type
    
    
    var obj = Obj[bool](a: false)
    
    
    Run

Is this a bug? Should it be reported?

Reply via email to