Skip to content

Missing implicit move in assignment #25057

@arnetheduck

Description

@arnetheduck

Nim Version

2.2.4, both orc and refc

Update: cannot repro with orc, must have been a fluke - only refc broken

Description

type PageRef = ref object
  store: ref seq[byte]

func init*(_: type PageRef, data: sink seq[byte]): PageRef =
  let a = addr data[0]
  let tmp = PageRef(store: new seq[byte])
  tmp.store[] = data

  assert a == addr tmp.store[][0]
  tmp


discard PageRef.init(@[byte 1, 2, 3])

Last use of data is assignment, it should be moved implicitly

Current Output


Expected Output


Known Workarounds

No response

Additional Information

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions