summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorTimothee Cour <timothee.cour2@gmail.com>2021-05-26 00:44:00 -0700
committerGitHub <noreply@github.com>2021-05-26 09:44:00 +0200
commit8df55d0ad735277683631bb8e5966ee75545de2b (patch)
treeb2d044b965381aca6a9b55d9794b1a2d51fc4050
parentc495628255330a559e3398663cc8872cca18b04d (diff)
downloadNim-8df55d0ad735277683631bb8e5966ee75545de2b.tar.gz
close #3482 no more cgen error with typed templates (#18094)
-rw-r--r--tests/misc/t3482.nim15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/misc/t3482.nim b/tests/misc/t3482.nim
new file mode 100644
index 000000000..33b3b8f40
--- /dev/null
+++ b/tests/misc/t3482.nim
@@ -0,0 +1,15 @@
+discard """
+  action: reject
+  nimout: "t3482.nim(13, 8) Error: undeclared identifier: 'output'"
+"""
+# bug #3482 (correct behavior since 1.4.0, cgen error in 1.2.0)
+template foo*(body: typed) =
+  if true:
+    body
+
+proc test =
+  foo:
+    var output = ""
+  echo output.len
+
+test()