Mercurial > projects > ldc
comparison test/structs3.d @ 8:5e69b77a5c51 trunk
[svn r12] fixed accessing aggregate fields of aggregates
removed some useless branches for successive scopes ala {}{}{}
author | lindquist |
---|---|
date | Thu, 27 Sep 2007 06:03:06 +0200 |
parents | 7a155ba88c53 |
children |
comparison
equal
deleted
inserted
replaced
7:7a155ba88c53 | 8:5e69b77a5c51 |
---|---|
1 module structs3; | 1 module structs3; |
2 | 2 |
3 struct S | 3 struct S |
4 { | 4 { |
5 float l; | |
6 char c; | 5 char c; |
6 float f; | |
7 } | 7 } |
8 | 8 |
9 struct T | 9 struct T |
10 { | 10 { |
11 S s; | 11 S s; |
12 long l; | 12 long l; |
13 } | 13 } |
14 | 14 |
15 void main() | 15 void main() |
16 { | 16 { |
17 T t; | |
18 float f = void; | |
19 float* fp = void; | |
20 {f = t.s.f;} | |
21 {t.s.f = 0.0;} | |
22 {fp = &t.s.f;} | |
23 {*fp = 1.0;} | |
24 {assert(t.s.f == 1.0);} | |
25 {assert(*(&t.s.f) == 1.0);} | |
26 {t.s.c = 'a';} | |
27 {assert(t.s.c == 'a');} | |
28 {t.l = 64;} | |
29 {assert(t.l == 64);} | |
17 } | 30 } |