mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
Move dmd files into compiler/
This commit is contained in:
parent
20bd0cacbd
commit
6374bb87b7
4579 changed files with 4 additions and 4 deletions
143
compiler/test/runnable/cppdtor.d
Normal file
143
compiler/test/runnable/cppdtor.d
Normal file
|
@ -0,0 +1,143 @@
|
|||
/*
|
||||
https://issues.dlang.org/show_bug.cgi?id=21693
|
||||
|
||||
RUN_OUTPUT:
|
||||
---
|
||||
CppA:
|
||||
1: CppA.~this
|
||||
CppB:
|
||||
2: CppB.~this
|
||||
2: CppA.~this
|
||||
CppC:
|
||||
3: CppC.~this
|
||||
3: CppB.~this
|
||||
3: CppA.~this
|
||||
CppC:
|
||||
4: CppC.~this
|
||||
4: CppB.~this
|
||||
4: CppA.~this
|
||||
CppNoDestruct:
|
||||
DA:
|
||||
1: DA.~this
|
||||
DB:
|
||||
2: DB.~this
|
||||
2: DA.~this
|
||||
DC:
|
||||
3: DC.~this
|
||||
3: DB.~this
|
||||
3: DA.~this
|
||||
DC:
|
||||
4: DC.~this
|
||||
4: DB.~this
|
||||
4: DA.~this
|
||||
---
|
||||
*/
|
||||
|
||||
extern (C) int printf(scope const char*, ...);
|
||||
|
||||
extern (C++) class CppA
|
||||
{
|
||||
int num;
|
||||
this(int num)
|
||||
{
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
printf("%d: CppA.~this\n", num);
|
||||
}
|
||||
}
|
||||
|
||||
extern (C++) class CppB : CppA
|
||||
{
|
||||
this(int num)
|
||||
{
|
||||
super(num);
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
printf("%d: CppB.~this\n", num);
|
||||
}
|
||||
}
|
||||
|
||||
extern (C++) class CppC : CppB
|
||||
{
|
||||
this(int num)
|
||||
{
|
||||
super(num);
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
printf("%d: CppC.~this\n", num);
|
||||
}
|
||||
}
|
||||
|
||||
extern (D) class DA
|
||||
{
|
||||
int num;
|
||||
this(int num)
|
||||
{
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
printf("%d: DA.~this\n", num);
|
||||
}
|
||||
}
|
||||
|
||||
extern (D) class DB : DA
|
||||
{
|
||||
this(int num)
|
||||
{
|
||||
super(num);
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
printf("%d: DB.~this\n", num);
|
||||
}
|
||||
}
|
||||
|
||||
extern (D) class DC : DB
|
||||
{
|
||||
this(int num)
|
||||
{
|
||||
super(num);
|
||||
}
|
||||
|
||||
~this()
|
||||
{
|
||||
printf("%d: DC.~this\n", num);
|
||||
}
|
||||
}
|
||||
|
||||
extern (C++) class CppNoDestruct
|
||||
{
|
||||
int num;
|
||||
this(int num)
|
||||
{
|
||||
this.num = num;
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
printf("CppA:\n"); { scope a = new CppA(1); }
|
||||
printf("CppB:\n"); { scope CppA b = new CppB(2); }
|
||||
printf("CppC:\n"); { scope CppA c = new CppC(3); }
|
||||
printf("CppC:\n"); { scope CppB c2 = new CppC(4); }
|
||||
|
||||
printf("CppNoDestruct:\n");
|
||||
{
|
||||
scope const nd = new CppNoDestruct(1);
|
||||
}
|
||||
|
||||
printf("DA:\n"); { scope a = new DA(1); }
|
||||
printf("DB:\n"); { scope DA b = new DB(2); }
|
||||
printf("DC:\n"); { scope DA c = new DC(3); }
|
||||
printf("DC:\n"); { scope DB c2 = new DC(4); }
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue