diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 76bc756e16..abab6fe44f 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -3005,7 +3005,7 @@ proc semExpr(c: PContext, n: PNode, flags: TExprFlags = {}): PNode = # the node is left intact for now discard of nkStaticExpr: result = semStaticExpr(c, n[0]) - of nkAsgn: result = semAsgn(c, n) + of nkAsgn, nkFastAsgn: result = semAsgn(c, n) of nkBlockStmt, nkBlockExpr: result = semBlock(c, n, flags) of nkStmtList, nkStmtListExpr: result = semStmtList(c, n, flags) of nkRaiseStmt: result = semRaise(c, n) diff --git a/tests/magics/t20938.nim b/tests/magics/t20938.nim new file mode 100644 index 0000000000..7341cbb917 --- /dev/null +++ b/tests/magics/t20938.nim @@ -0,0 +1,12 @@ +discard """ + cmd: "nim c --mm:refc $file" + action: "compile" +""" + +template foo(x: typed) = + discard x + +foo: + var x = "hello" + x.shallowCopy("test") + true