Mercurial > projects > ldc
comparison test/classes6.d @ 11:d3ee9efe20e2 trunk
[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.
author | lindquist |
---|---|
date | Tue, 02 Oct 2007 05:10:18 +0200 |
parents | dafae18f9c08 |
children | d9d5d59873d8 |
comparison
equal
deleted
inserted
replaced
10:c0f2c47e5034 | 11:d3ee9efe20e2 |
---|---|
2 | 2 |
3 class C | 3 class C |
4 { | 4 { |
5 void f() | 5 void f() |
6 { | 6 { |
7 printf("hello world\n"); | 7 printf("world\n"); |
8 } | 8 } |
9 } | 9 } |
10 | 10 |
11 class D : C | |
12 { | |
13 void f() | |
14 { | |
15 printf("moon\n"); | |
16 } | |
17 } | |
18 | |
19 | |
20 extern(C) | |
21 { | |
22 void srand(uint seed); | |
23 int rand(); | |
24 } | |
25 | |
26 import llvm.intrinsic; | |
27 | |
11 void main() | 28 void main() |
12 { | 29 { |
13 scope c = new C; | 30 C c; |
31 srand(readcyclecounter()); | |
32 if (rand() % 2) | |
33 c = new C; | |
34 else | |
35 c = new D; | |
14 c.f(); | 36 c.f(); |
15 } | 37 } |