Skip to content

ICE "param not init" with templates and callbacks #14067

Closed
@arnetheduck

Description

@arnetheduck

Example

type
  Result[T, E] = object

  DataProc = proc(val: openArray[byte])
  GetProc = proc (onData: DataProc): Result[bool, cstring]

func get[T, E](self: Result[T, E]): T =
  discard

template `[]`[T, E](self: Result[T, E]): T =
  self.get()

proc testKVStore() =
  var v: seq[byte]
  var p: GetProc

  discard p(proc(data: openArray[byte]) =
      v = @data
    )[]

testKVStore()

Current Output

/home/arnetheduck/status/nim-beacon-chain/beacon_chain/test.nim(18, 12) Error: internal error: expr: param not init data_17356077
[arnetheduck@tempus nim-beacon-chain]$ nim -v
Nim Compiler Version 1.3.1 [Linux: amd64]
Compiled at 2020-04-21
Copyright (c) 2006-2020 by Andreas Rumpf

git hash: b4e9f8e814373fc38741736197d88475663ce758
active boot switches: -d:release

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions