Files
Nim/tests/lent/tlents.nim
ringabout ceaa7fb4e8 fixes #23949; cannot return lent expression from conditionals like case (#25190)
fixes #23949

It can also allow  `endsInNoReturn` in branches later
2025-09-24 06:29:57 +02:00

26 lines
324 B
Nim

discard """
targets: "c cpp"
"""
type A = object
field: int
proc x(a: A): lent int =
result = case true
of true:
a.field
of false:
a.field
proc y(a: A): lent int =
result = if true:
a.field
else:
a.field
block:
var a = A(field: 1)
doAssert x(a) == 1
doAssert y(a) == 1