-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Open
Description
Nim Version
Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-09-25
Copyright (c) 2006-2025 by Andreas Rumpf
git hash: 9f74712
active boot switches: -d:release
Description
Nim 1.6.20 works as expected; the regression is present in Nim +2.0
type Conf = object
val: int
const defaultConf = Conf(val: 123)
template foo(conf) =
echo conf.val
var conf2 = conf
echo conf2.val
static:
var conf = defaultConf
conf = defaultConf # removing this results in the expected output
conf.val = 2
foo(defaultConf)
Current Output
123
2
Expected Output
123
123
Known Workarounds
wrap the static body in a proc.
Additional Information
No response
Metadata
Metadata
Assignees
Labels
No labels