Skip to content

Misbehaving codegen with static[T] + {.global.} + {.inline.} + different modules #5945

Open
@yglukhov

Description

@yglukhov
# a.nim
proc printGlobalStaticString*(s: static[string]) {.inline.} =
    var r {.global.} = s
    echo r

printGlobalStaticString("bar")
# b.nim
import a
printGlobalStaticString("foo")
printGlobalStaticString("bar")
nim c -r b.nim

Expected output:

bar
foo
bar

Actual output:

bar
bar
bar

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions