PR c++/85553
[official-gcc.git] / gcc / testsuite / g++.dg / ext / dllexport-MI1.C
blob08e65ec960886ce8237ad3a49ab3428714affef1
1 // { dg-do compile { target i?86-*-cygwin* i?86-*-mingw* x86_64-*-mingw*} }
2 //  Test that non-virtual MI thunks are exported.
5 // To build the dll and client app:
6 // g++ -shared -o MI.dll dllexport-MI1.C
7 // g++ -o MItest.exe dllimport-MI1.C -L. MI.dll
9 #define BUILDING_MI_DLL
10 #include "dll-MI1.h"
12 MBase::~MBase(){}
14 int D1::vf() const { return D1_return; }
16 D2::D2() { }
17 D2::D2 (D2 const&) { }
18 int D2::vf() const { return D2_return; }
20 int MI1::vf() const { return D1::vf();}
22 // a dllexported object 
23 DLL_IMPEXP MI1 dllMI1;
25 // use default copy ctor 
26 DLL_IMPEXP MI1 dllMI1Copy =  dllMI1;
28 // Scan for export of some methods that are undefined in dllimportMI1.C,
30 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZNK2D12vfEv" } }
31 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZNK2D22vfEv" } }
32 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZNK3MI12vfEv" } }
34 // and MI thunks,
36 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZThn._NK3MI12vfEv" } }
37 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZTv0_n.._NK2D12vfEv" } }
39 // and a vtable data variable.
41 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZTV2D1\[\\\\\"\]*,data" } }
43 // an explicit copy ctor
44 // { dg-final { scan-assembler "-export:\[\\\\\"\]*_ZN2D2C2ERKS_" } }
46 // but not implicit copy ctor generated by compiler
47 // nor implicit dtor
49 // { dg-final { scan-assembler-not "-export:\[\\\\\"\]*_ZN2D1C2ERKS_" } }
50 // { dg-final { scan-assembler-not "-export:\[\\\\\"\]*_ZN2D1D2Ev" } }