Mercurial > projects > ldc
comparison test/d.d @ 73:b706170e24a9 trunk
[svn r77] Fixed foreach on slice.
Fixed some nested function problems when accessing outer function parameters.
Major changes to handling of structs.
Initial support for unions.
Probably more...
author | lindquist |
---|---|
date | Wed, 31 Oct 2007 03:11:32 +0100 |
parents | c53b6e3fe49a |
children |
comparison
equal
deleted
inserted
replaced
72:d7e764e62462 | 73:b706170e24a9 |
---|---|
1 module d; | 1 module d; |
2 /* | 2 |
3 void main() | 3 void main() |
4 { | 4 { |
5 int delegate() dg; | 5 int delegate() dg; |
6 int i = dg(); | |
7 | 6 |
8 struct S | 7 struct S |
9 { | 8 { |
10 int i; | 9 int i; |
11 long l; | 10 long l; |
17 } | 16 } |
18 } | 17 } |
19 | 18 |
20 S s; | 19 S s; |
21 auto dg2 = &s.func; | 20 auto dg2 = &s.func; |
22 i = dg2(); | 21 int i = dg2(); |
22 assert(i == 42); | |
23 | 23 |
24 i = f(dg2, 1); | 24 i = f(dg2, 1); |
25 assert(i == 43); | |
25 } | 26 } |
26 | 27 |
27 int f(int delegate() dg, int i) | 28 int f(int delegate() dg, int i) |
28 { | 29 { |
29 return dg() + i; | 30 return dg() + i; |
30 } | 31 } |
31 */ | |
32 | 32 |
33 /* | |
33 struct S | 34 struct S |
34 { | 35 { |
35 int i; | 36 int i; |
36 float f; | 37 float f; |
37 int square() | 38 int square() |
44 | 45 |
45 void main() | 46 void main() |
46 { | 47 { |
47 auto dg = &s.square; | 48 auto dg = &s.square; |
48 } | 49 } |
50 */ |