Mercurial > projects > ldc
annotate tests/mini/s.d @ 979:523bf4f166bc
Fix some assembler issues:
The assembler was miscompiling "add" (specifically, the "add reg/mem, imm"
variations).
The change that caused this seems to have been made because without it, some
"add"s didn't compile at all.
This patch reverts the previous change, and makes sure assembler operands are
remapped correctly even though the input operands auto-generated due to
updating operations aren't explicitly used.
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Wed, 18 Feb 2009 21:46:14 +0100 |
parents | d92acb81a583 |
children |
rev | line source |
---|---|
138 | 1 module s; |
2 | |
3 interface Inter | |
4 { | |
5 void inter(); | |
6 } | |
7 | |
8 interface Inter2 | |
9 { | |
10 void inter2(); | |
11 } | |
12 | |
13 interface InterOne : Inter | |
14 { | |
15 void interOne(); | |
16 } | |
17 | |
18 abstract class ClassAbstract : InterOne | |
19 { | |
20 abstract void inter(); | |
21 abstract void interOne(); | |
22 } | |
23 | |
24 class TheClassOne : ClassAbstract | |
25 { | |
26 void inter() | |
27 { | |
28 } | |
29 void interOne() | |
30 { | |
31 } | |
32 } | |
33 | |
34 class TheClassTwo : TheClassOne, Inter2 | |
35 { | |
36 long l; | |
37 double d; | |
38 | |
39 void inter2() | |
40 { | |
41 } | |
42 } | |
43 | |
44 extern(C) int printf(char*, ...); | |
45 | |
46 void main() | |
47 { | |
48 printf("classinfo test\n"); | |
49 { | |
50 auto c = new TheClassOne; | |
51 { | |
52 auto ci = c.classinfo; | |
53 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
54 printf("ci.interfaces.length = %lu\n", ci.interfaces.length); | |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
55 foreach (i, iface; ci.interfaces) |
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
56 printf("i[%d] = %.*s\n", i, iface.classinfo.name.length, iface.classinfo.name.ptr); |
138 | 57 } |
58 } | |
59 { | |
60 auto c = new TheClassTwo; | |
61 { | |
62 auto ci = c.classinfo; | |
63 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
64 printf("ci.interfaces.length = %lu\n", ci.interfaces.length); | |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
65 foreach (i, iface; ci.interfaces) |
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
66 printf("i[%d] = %.*s\n", i, iface.classinfo.name.length, iface.classinfo.name.ptr); |
138 | 67 } |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
68 InterOne i = c; |
138 | 69 { |
70 auto ci = i.classinfo; | |
71 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
72 } | |
807
d92acb81a583
Add interface minitest, rework s.d.
Christian Kamm <kamm incasoftware de>
parents:
341
diff
changeset
|
73 auto i2 = cast(Inter2)c; |
138 | 74 { |
75 auto ci = i2.classinfo; | |
76 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
77 } | |
78 auto o = cast(Object)i2; | |
79 { | |
80 auto ci = o.classinfo; | |
81 printf("ci = %.*s\n", ci.name.length, ci.name.ptr); | |
82 } | |
83 } | |
84 } |