summary refs log tree commit diff stats
path: root/tests/cpp/tpassbypragmas.nim
blob: f4301656afb43385eec8e331076da05d0884f76b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
discard """
  targets: "cpp"
  cmd: "nim cpp $file"
"""
{.emit:"""/*TYPESECTION*/

  template<typename T>
  struct Box {
      T first;
  };
  struct Foo {
  void test(void (*func)(Box<Foo>& another)){

    };
  };
""".}

type 
  Foo {.importcpp.} = object
  Box[T] {.importcpp:"Box<'0>".} = object
    first: T

proc test(self: Foo, fn: proc(another {.byref.}: Box[Foo]) {.cdecl.}) {.importcpp.}

proc fn(another {.byref.} : Box[Foo]) {.cdecl.} = discard

Foo().test(fn)