t6217.nim 233 B

1234567891011121314151617181920
  1. discard """
  2. output: '''
  3. start
  4. side effect!
  5. end
  6. '''
  7. """
  8. # bug #6217
  9. template optMul{`*`(a, 2)}(a: int{noSideEffect}): int = a+a
  10. proc f(): int =
  11. echo "side effect!"
  12. result = 55
  13. echo "start"
  14. doAssert f() * 2 == 110
  15. echo "end"