nim-lang / Nim

Nim is a statically typed compiled systems programming language. It combines successful concepts from mature languages like Python, Ada and Modula. Its design focuses on efficiency, expressiveness, and elegance (in that order of priority).

Home Page:https://nim-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Moves disallowed in top-level block

Buldram opened this issue · comments

Description

type MyIsolated[T] = object
  val: T

proc `=copy`*[T](dest: var MyIsolated[T]; src: MyIsolated[T]) {.error.}

block:
  let a = MyIsolated[int](val: 3)
  let b = a

Reports that a must be copied, I'd guess it's being handled as if it's a global variable.

Nim Version

cd3cf3a

Current Output

(8, 11) Error: '=copy' is not available for type <MyIsolated>; requires a copy because it's not the last read of 'a'; routine: a

Expected Output

No response

Possible Solution

No response

Additional Information

No response