summary refs log tree commit diff stats
path: root/tests/misc
diff options
context:
space:
mode:
authorBung <crc32@qq.com>2023-08-04 19:35:43 +0800
committerGitHub <noreply@github.com>2023-08-04 13:35:43 +0200
commit26f183043f9e58eb4954d50a5d130d8684909936 (patch)
tree22935c744575ffed86fddc340317502e1c73dd1d /tests/misc
parent3efabd3ec669914ad2bb42a614f7277caf662562 (diff)
downloadNim-26f183043f9e58eb4954d50a5d130d8684909936.tar.gz
fix #20883 Unspecified generic on default value segfaults the compiler (#21172)
* fix #20883 Unspecified generic on default value segfaults the compiler

* fallback to isGeneric

* change to closer error

* Update t20883.nim
Diffstat (limited to 'tests/misc')
-rw-r--r--tests/misc/t20883.nim12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/misc/t20883.nim b/tests/misc/t20883.nim
new file mode 100644
index 000000000..d98feaa14
--- /dev/null
+++ b/tests/misc/t20883.nim
@@ -0,0 +1,12 @@
+discard """
+  action: reject
+  errormsg: "type mismatch: got <float64> but expected 'typeof(U(0.000001))'"
+  line: 8
+  column: 22
+"""
+
+proc foo*[U](x: U = U(1e-6)) =
+  echo x
+
+foo[float]()
+foo()