annotate run/bug_20041226_A.d @ 678:f9e1d827a255

div. fixes
author thomask
date Wed, 21 Sep 2005 21:15:30 +0000
parents ae135d48d8b5
children 1e6afb94ce6d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
1 // $HeadURL$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
2 // $Date$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
3 // $Author$
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
4
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
5 // @author@ h3r3tic <foo@bar.baz>
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
6 // @date@ 2004-12-26
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
7 // @uri@ news:cqmufn$26oj$1@digitaldaemon.com
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
8 // @url@ nntp://digitalmars.com/digitalmars.D.bugs/2606
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
9
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
10 // __DSTRESS_DFLAGS__ -inline
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
11
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
12 module dstress.run.bug_20041226_A;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
13
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
14 void dummy(...){
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
15 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
16
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
17 struct vec3{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
18 vec3 opSub(vec3 a){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
19 vec3 x;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
20 return x;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
21 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
22 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
23
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
24 struct Face{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
25 vec3 a;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
26 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
27
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
28 struct Mesh{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
29 Face[] faces;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
30 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
31
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
32 struct GeomObject{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
33 Mesh mesh;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
34 char[] name;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
35 vec3 xlate;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
36 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
37
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
38 class AseLoader{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
39 this(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
40 GeomObject go;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
41 go.name = "NODE";
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
42 geomObjects ~= go;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
43 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
44
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
45 GeomObject[] geomObjects;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
46 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
47
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
48
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
49 void extractTriangles(GeomObject geomObj){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
50 void foobar(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
51 try{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
52 writefln("name: ", geomObj.name);
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
53
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
54 return; // avoid accessing the array with 0 elements in the next line
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
55 geomObj.mesh.faces[0].a - geomObj.xlate; // when this line is removed, the bug doesn't appear
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
56 }catch(Object err){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
57 throw err;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
58 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
59 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
60
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
61 foobar();
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
62 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
63
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
64 int main(){
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
65 try{
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
66 AseLoader al = new AseLoader;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
67
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
68 foreach(GeomObject go; al.geomObjects){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
69 dummy("processing ", go.name);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
70 extractTriangles(go);
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
71 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
72 }catch(Object err){
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
73 dummy("Exception caught:", err);
219
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
74 }
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
75
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
76 return 0;
249516e487f9 h3r3tic <foo@bar.baz>
thomask
parents:
diff changeset
77 }
678
f9e1d827a255 div. fixes
thomask
parents: 248
diff changeset
78