Nim icon indicating copy to clipboard operation
Nim copied to clipboard

C codegen error with `Option[lent int]`

Open haxscramper opened this issue 5 years ago • 2 comments
trafficstars

C codegen error when using Option[lent int]

Example

{.experimental: "views".}
import options
var a = [1, 2, 3, 4]
let o: Option[lent int] = some(a[0])

Current Output

Error: incompatible types when assigning to type ‘tyObject_Option__9bNiDL2UwApe2u9bmOJP4a9aw’ from type ‘tyObject_Option__Ryv9bNNePiiahF9b3Btk2KGA’
  169 |  o__vCNm9b4v9bUjkXuEJRVnKRSg = some__m1OjIFHE7x2EQs5RG5pOEAoptions(a__p9cXZaNbCqLkcGBblS5Wyrg[(((NI) 0))- 0]);
      |                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: execution of an external compiler program 'gcc -c  -w -fmax-errors=3   -I'/home/test/.choosenim/toolchains/nim-#devel/lib' -I/mnt/workspace/github/hax-nim/hack-test -o /home/test/.cache/nim/view_types_d/@mview_types.nim.c.o /home/test/.cache/nim/view_types_d/@mview_types.nim.c' failed with exit code: 1

Nim version

$ nim --version
Nim Compiler Version 1.3.7 [Linux: amd64]
Compiled at 2020-10-08
Copyright (c) 2006-2020 by Andreas Rumpf

active boot switches: -d:release

haxscramper avatar Oct 09 '20 09:10 haxscramper