type
      Object = object
        a: int
        b: ref int
    
    template bug(body: untyped) =
      proc fn(): auto {.cdecl.} =
        body
      
      discard fn()
    
    bug:
      echo "This message should only appear once."
      return Object()
    
    
    
    Run

Output with the last verion of compiler:
    
    
    This message should only appear once.
    This message should only appear once.
    
    
    Run

The code in the body runs twice, which is a very strange bug. 

Reply via email to