mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-12 14:23:45 +00:00
fixes #24760 I tried `incl` `tfHasAsgn` to nontrivial assignment, but that solution seems to break too many things. Instead, in this PR, `passCopyToSink` now checks nontrivial assignment
20 lines
456 B
Nim
20 lines
456 B
Nim
discard """
|
|
matrix: "--mm:orc"
|
|
errormsg: "=dup' is not available for type <B>, which is inferred from unavailable '=copy'; requires a copy because it's not the last read of 'b'; another read is done here: t24760.nim(19, 8); routine: g"
|
|
"""
|
|
|
|
type
|
|
A {.inheritable.} = object
|
|
B = object of A
|
|
|
|
proc `=copy`(a: var A, x: A) {.error.}
|
|
#proc `=copy`(a: var B, x: B) {.error.}
|
|
|
|
proc ffff(v: sink B) =
|
|
echo v
|
|
|
|
proc g() =
|
|
var b: B
|
|
ffff(b)
|
|
ffff(b)
|
|
g() |