mirror of
https://github.com/nim-lang/Nim.git
synced 2026-02-14 23:33:28 +00:00
fixes #206
This commit is contained in:
@@ -260,7 +260,7 @@ proc applyRule*(c: PContext, s: PSym, n: PNode): PNode =
|
||||
# couldn't bind parameter:
|
||||
if isNil(x): return nil
|
||||
result.add(x)
|
||||
if requiresAA: addToArgList(args, n)
|
||||
if requiresAA: addToArgList(args, x)
|
||||
# perform alias analysis here:
|
||||
if requiresAA:
|
||||
for i in 1 .. < params.len:
|
||||
|
||||
19
tests/trmacros/tnoalias2.nim
Normal file
19
tests/trmacros/tnoalias2.nim
Normal file
@@ -0,0 +1,19 @@
|
||||
discard """
|
||||
output: '''0'''
|
||||
"""
|
||||
|
||||
# bug #206
|
||||
template optimizeOut{testFunc(a, b)}(a: int, b: int{alias}) : expr = 0
|
||||
|
||||
proc testFunc(a, b: int): int = result = a + b
|
||||
var testVar = 1
|
||||
echo testFunc(testVar, testVar)
|
||||
|
||||
|
||||
template ex{a = b + c}(a : int{noalias}, b, c : int) =
|
||||
a = b
|
||||
inc a, b
|
||||
echo "came here"
|
||||
|
||||
var x = 5
|
||||
x = x + x
|
||||
Reference in New Issue
Block a user