Files
Nim/tests/errmsgs/t25117.nim
ringabout c8456eacd5 fixes #25117; requiresInit not checked for result if it has been used (#25151)
fixes #25117


errors on `requiresInit` of `result` if it is used before
initialization. Otherwise

```nim
    # prevent superfluous warnings about the same variable:
    a.init.add s.id
```

It produces a warning, and this line prevents it from being recognized
by the `requiresInit` check in `trackProc`
2025-09-09 16:22:05 +02:00

13 lines
211 B
Nim

discard """
errormsg: "'result' requires explicit initialization"
"""
type RI {.requiresInit.} = object
v: int
proc xxx(v: var RI) = discard
proc f(T: type): T =
xxx(result) # Should fail
discard f(RI)