Nim icon indicating copy to clipboard operation
Nim copied to clipboard

instantiating `set[T]` with T = int crashes compiler with int128.nim error

Open timotheecour opened this issue 4 years ago • 2 comments

Example

when true:
  var a = {0,1} # works
  static: echo a.type # set[range 0..65535(int)]
  proc foo[T](a: T, b: set[T]) = discard
  foo(3'u16, {0'u16,1}) # works
  foo(3, {0,1}) # compiler/int128.nim(72, 11) `arg.sdata(2) == 0` out of range [AssertionDefect]

Current Output

compiler/int128.nim(72, 11) `arg.sdata(2) == 0` out of range [AssertionDefect]

Expected Output

cannot instantiate set because T.sizeof > ... with T = int

Additional Information

1.5.1 9ca3218a6dad49e22c236e4fa309c3c281b9668a I'm adding this to https://github.com/nim-lang/Nim/issues/14989

timotheecour avatar May 08 '21 17:05 timotheecour