Skip to content

Commit

Permalink
fix #6497 (#16027)
Browse files Browse the repository at this point in the history
* fix #6497

* add testcase for #16027

(cherry picked from commit 581bcfe)
  • Loading branch information
ringabout authored and narimiran committed Nov 18, 2020
1 parent 462209f commit 5977f55
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions compiler/ast.nim
Expand Up @@ -1412,6 +1412,7 @@ proc copySym*(s: PSym): 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
Expand Down
13 changes: 13 additions & 0 deletions 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

0 comments on commit 5977f55

Please sign in to comment.