File: dllimport_gh3926.d

package info (click to toggle)
ldc 1%3A1.40.0-5
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 63,308 kB
  • sloc: cpp: 85,368; ansic: 21,877; makefile: 1,705; sh: 1,018; asm: 584; objc: 135; exp: 48; python: 12
file content (31 lines) | stat: -rw-r--r-- 942 bytes parent folder | download
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
30
31
// REQUIRES: Windows

// RUN: %ldc -output-ll -dllimport=all -of=%t.ll %s && FileCheck %s < %t.ll

import std.variant : Variant; // pre-instantiated template

void foo()
{
    // define TypeInfo_Struct referencing dllimported Variant vtable and init symbol
    auto t = typeid(Variant);
}

// no direct init symbol refs:
// CHECK-NOT: @_D3std7variant__T8VariantN{{.*}}6__initZ

// dllimported init symbol:
// CHECK: @_D3std7variant__T8VariantN{{.*}}6__initZ = external dllimport

// no direct init symbol refs:
// CHECK-NOT: @_D3std7variant__T8VariantN{{.*}}6__initZ

// check generated CRT constructor:
// CHECK:      define private void @ldc.dllimport_relocation()

// should set the vptr:
// CHECK:      if:
// CHECK-NEXT: store ptr @_D15TypeInfo_Struct6__vtblZ,

// should set m_init.ptr:
// CHECK:      if1:
// CHECK-NEXT: store ptr {{.*}}@_D3std7variant__T8VariantN{{.*}}6__initZ, {{.*}}TypeInfo_S3std7variant__T8VariantN{{.*}}6__initZ