summary refs log tree commit diff stats
path: root/tests/misc/mimportc.nim
blob: 602c6372def0416dfa5f1eca2985e46e96595502 (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
#[
this test will grow with more importc+importcpp tests; see driver in trunner.nim
]#

{.emit:"""
struct A {
  static int fun0(int a){
    return a;
  }
  static int& fun1(int& a){
    return a;
  }
};
""".}

proc fun0*(a: cint): int {.importcpp:"A::$1(@)".}
proc fun1*(a: var cint): var int {.importcpp:"A::$1(@)".} =
  ## some comment; this test is for #14314
  runnableExamples: discard

proc main()=
  var a = 10.cint
  doAssert fun0(a) == a
  doAssert fun1(a).addr == a.addr
  echo "witness"
main()