summary refs log tree commit diff stats
path: root/tests/cpp
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-09-13 16:09:50 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-09-13 16:33:43 +0200
commit3710e62241fe32fee7e54d804d59bfacf56fcf35 (patch)
treefcbce65446791bed262b6944a6a6926878e64dd0 /tests/cpp
parent3a5edd2c6c61ce06cd780de2b53d6839fac71d7c (diff)
downloadNim-3710e62241fe32fee7e54d804d59bfacf56fcf35.tar.gz
fixes #4625
Diffstat (limited to 'tests/cpp')
-rw-r--r--tests/cpp/tempty_generic_obj.nim22
1 files changed, 22 insertions, 0 deletions
diff --git a/tests/cpp/tempty_generic_obj.nim b/tests/cpp/tempty_generic_obj.nim
new file mode 100644
index 000000000..e2957a5cd
--- /dev/null
+++ b/tests/cpp/tempty_generic_obj.nim
@@ -0,0 +1,22 @@
+discard """
+  cmd: "nim cpp $file"
+  output: '''int
+float'''
+"""
+
+import typetraits
+
+# bug #4625
+type
+  Vector {.importcpp: "std::vector<'0 >", header: "vector".} [T] = object
+
+proc initVector[T](): Vector[T] {.importcpp: "'0(@)", header: "vector", constructor.}
+
+proc doSomething[T](v: var Vector[T]) =
+  echo T.name
+
+var v = initVector[int]()
+v.doSomething()
+
+var vf = initVector[float]()
+vf.doSomething() # Nim uses doSomething[int] here in C++