summary refs log tree commit diff stats
path: root/tests/cpp/tdont_init_instantiation.nim
blob: a13a3f6b4ed0bae7712fc2538d3ed3a74acda302 (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
28
29
discard """
  targets: "cpp"
  output: ''''''
  disabled: true
"""

# bug #5140
{.emit:"""
#import <cassert>

template <typename X> class C {
  public:
    int d;

    C(): d(1) { }

    C<X>& operator=(const C<X> other) {
      assert(d == 1);
    }
};
""".}

type C[X] {.importcpp, header: "<stdio.h>", nodecl.} = object
proc mkC[X]: C[X] {.importcpp: "C<'*0>()", constructor, nodecl.}

proc foo(): C[int] =
  result = mkC[int]()

let gl = foo()