diff options
-rw-r--r-- | compiler/ast.nim | 1 | ||||
-rw-r--r-- | tests/ccgbugs/t16027.nim | 13 |
2 files changed, 14 insertions, 0 deletions
diff --git a/compiler/ast.nim b/compiler/ast.nim index 3d14aba66..c75a149c0 100644 --- a/compiler/ast.nim +++ b/compiler/ast.nim @@ -1441,6 +1441,7 @@ proc copySym*(s: PSym; id: ItemId): PSym = result.position = s.position result.loc = s.loc result.annex = s.annex # BUGFIX + result.constraint = s.constraint if result.kind in {skVar, skLet, skField}: result.guard = s.guard result.bitsize = s.bitsize diff --git a/tests/ccgbugs/t16027.nim b/tests/ccgbugs/t16027.nim new file mode 100644 index 000000000..58f15eb6e --- /dev/null +++ b/tests/ccgbugs/t16027.nim @@ -0,0 +1,13 @@ +discard """ + ccodecheck: "__restrict__" + action: compile + joinable: false +""" + +# see bug #16027 +iterator myitems(s: seq[int]): int = + var data {.codegenDecl: "$# __restrict__ $#".} : ptr int = nil + yield 1 + +for i in @[1].myitems: + discard |