summary refs log blame commit diff stats
path: root/tests/cpp/tdont_init_instantiation.nim
blob: fe487fba085cd6493d8d9d7b11e40ac18b685556 (plain) (tree)
1
2
3
4
           
                
                
                























                                                                
              
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{.importcpp, header: "<stdio.h>", nodecl.} [X] = object
proc mkC[X]: C[X] {.importcpp: "C<'*0>()", constructor, nodecl.}

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

let gl = foo()