mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-02-10 00:43:13 +01:00
[svn r15] * Fixed a bunch problems with virtual calls. Seems I did some rather poor testing.
* Now 50/51 tests compile. * Added a simple runalltests.d scripts that should be run with 'gdmd -run runalltests.d' - LLVMDC will not compile it yet.
This commit is contained in:
@@ -4,12 +4,34 @@ class C
|
||||
{
|
||||
void f()
|
||||
{
|
||||
printf("hello world\n");
|
||||
printf("world\n");
|
||||
}
|
||||
}
|
||||
|
||||
class D : C
|
||||
{
|
||||
void f()
|
||||
{
|
||||
printf("moon\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
extern(C)
|
||||
{
|
||||
void srand(uint seed);
|
||||
int rand();
|
||||
}
|
||||
|
||||
import llvm.intrinsic;
|
||||
|
||||
void main()
|
||||
{
|
||||
scope c = new C;
|
||||
C c;
|
||||
srand(readcyclecounter());
|
||||
if (rand() % 2)
|
||||
c = new C;
|
||||
else
|
||||
c = new D;
|
||||
c.f();
|
||||
}
|
||||
|
||||
21
test/classes7.d
Normal file
21
test/classes7.d
Normal file
@@ -0,0 +1,21 @@
|
||||
module classes7;
|
||||
|
||||
class C
|
||||
{
|
||||
int i=0;
|
||||
void f()
|
||||
{
|
||||
i=42;
|
||||
}
|
||||
void g()
|
||||
{
|
||||
f();
|
||||
}
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
scope c = new C;
|
||||
c.g();
|
||||
assert(c.i == 43);
|
||||
}
|
||||
Reference in New Issue
Block a user