annotate run/i/inline_11_A.d @ 1489:b8c0195059d9

changed nntp: URLs to http: URLs
author thomask
date Mon, 09 Apr 2007 13:47:01 +0000
parents 9dcac8d4e97f
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
595
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
1 // $HeadURL$
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
2 // $Date$
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
3 // $Author$
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
4
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
5 // @author@ Victor Nakoryakov <nail-mail@mail.ru>
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
6 // @date@ 2005-06-25
1489
b8c0195059d9 changed nntp: URLs to http: URLs
thomask
parents: 1091
diff changeset
7 // @uri@ http://www.digitalmars.com/pnews/read.php?server=news.digitalmars.com&group=digitalmars.D.bugs&artnum=4396
595
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
8
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
9 module dstress.run.i.inline_11_A;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 595
diff changeset
10
595
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
11 struct Struct{
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
12 int i;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
13
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
14 Struct foo(){
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
15 Struct s;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
16 int a = i;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 595
diff changeset
17 int b = s.i;
595
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
18 with (s) {
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
19 i+=2;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
20 }
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
21 assert(a==i);
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
22 assert(b+2==s.i);
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
23 return s;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
24 }
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
25
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
26 Struct bar(){
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
27 return Struct.foo() * Struct.foo();
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
28 }
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
29
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
30 Struct opMul(Struct s){
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
31 Struct ss;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
32 ss.i = s.i * i;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
33 return ss;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
34 }
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
35 }
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
36
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
37 int main(){
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
38 Struct s;
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
39 assert(s.bar().i==4);
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 595
diff changeset
40 return 0;
595
8c65d48f3d79 inline / opMul /with
thomask
parents:
diff changeset
41 }