annotate tests/mini/union5.d @ 715:30b42a283c8e

Removed TypeOpaque from DMD. Changed runtime functions taking opaque[] to void[]. Implemented proper type painting, to avoid "resizing" array casts in runtime calls that previously took opaque[]. Implemented dynamic arrays as first class types, this implements proper ABI for these types on x86. Added dwarf region end after call to assert function, fixes some problems with llvm not allowing this to be missing. Reverted change to WithStatement from rev [704] it breaks MiniD, mini/with2.d needs to be fixed some other way... Fixed tango bug 1339 in runtime, problem with _adReverseChar on invalid UTF-8. Disabled .bc generation in the compiler runtime part, genobj.d triggers some llvm bug when using debug info. the .o seems to work fine.
author Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
date Wed, 22 Oct 2008 14:55:33 +0200
parents 44f08170f4ef
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
76
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
1 module union5;
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
2
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
3 union S
76
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
4 {
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
5 T t;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
6 U u;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
7 uint i;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
8 struct {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
9 ushort sl,sh;
76
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
10 }
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
11 }
76
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
12
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
13 struct T
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
14 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
15 int i;
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
16 }
76
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
17
443
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
18 struct U
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
19 {
44f08170f4ef Removed tango from the repository and instead added a runtime dir with the files needed to patch and build tango from svn.
Tomas Lindquist Olsen <tomas.l.olsen@gmail.com>
parents: 341
diff changeset
20 float f;
76
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
21 }
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
22
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
23 void main()
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
24 {
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
25 S s;
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
26 assert(s.t.i == 0);
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
27 assert(s.u.f == 0);
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
28 s.t.i = -1;
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
29 assert(s.i == 0xFFFF_FFFF);
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
30 float f = 3.1415;
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
31 s.u.f = f;
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
32 uint pi = *cast(uint*)&f;
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
33 assert(s.i == pi);
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
34 assert(s.sl == (pi&0xFFFF));
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
35 assert(s.sh == (pi>>>16));
9e1bd80a7e98 [svn r80] Fixed union literals
lindquist
parents:
diff changeset
36 }