diff options
-rw-r--r-- | compiler/sempass2.nim | 2 | ||||
-rw-r--r-- | tests/effects/teffects10.nim | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/compiler/sempass2.nim b/compiler/sempass2.nim index 4eac6ef13..f0d6c6c7a 100644 --- a/compiler/sempass2.nim +++ b/compiler/sempass2.nim @@ -552,7 +552,7 @@ proc isNoEffectList(n: PNode): bool {.inline.} = n.len == 0 or (n[tagEffects] == nil and n[exceptionEffects] == nil) proc isTrival(caller: PNode): bool {.inline.} = - result = caller.kind == nkSym and caller.sym.magic in {mEqProc, mIsNil, mMove, mWasMoved} + result = caller.kind == nkSym and caller.sym.magic in {mEqProc, mIsNil, mMove, mWasMoved, mSwap} proc trackOperandForIndirectCall(tracked: PEffects, n: PNode, paramType: PType; caller: PNode) = let a = skipConvAndClosure(n) diff --git a/tests/effects/teffects10.nim b/tests/effects/teffects10.nim new file mode 100644 index 000000000..8193b394a --- /dev/null +++ b/tests/effects/teffects10.nim @@ -0,0 +1,12 @@ +discard """ +action: compile +""" + +# https://github.com/nim-lang/Nim/issues/15495 + +proc f() {.raises: [].} = + var a: proc () + var b: proc () + swap(a, b) + +f() |