summary refs log tree commit diff stats
path: root/tests/template/twrongsymkind.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/template/twrongsymkind.nim')
-rw-r--r--tests/template/twrongsymkind.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/template/twrongsymkind.nim b/tests/template/twrongsymkind.nim
new file mode 100644
index 000000000..be3d8c652
--- /dev/null
+++ b/tests/template/twrongsymkind.nim
@@ -0,0 +1,20 @@
+discard """
+  errormsg: "cannot use symbol of kind 'var' as a 'param'"
+  line: 20
+"""
+
+# bug #3158
+
+type
+  MyData = object
+      x: int
+
+template newDataWindow(data: ref MyData): stmt =
+    proc testProc(data: ref MyData) =
+        echo "Hello, ", data.x
+    testProc(data)
+
+var d: ref MyData
+new(d)
+d.x = 10
+newDataWindow(d)