annotate run/o/opCast_04_B.d @ 1294:8a9ce6778db2

[Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances Stewart Gordon <smjg@iname.com> 2006-12-13 http://d.puremagic.com/issues/show_bug.cgi?id=686
author thomask
date Sat, 30 Dec 2006 15:39:26 +0000
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1294
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
1 // $HeadURL$
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
2 // $Date$
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
3 // $Author$
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
4
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
5 // @author@ Stewart Gordon <smjg@iname.com>
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
6 // @date@ 2006-12-13
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=686
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
8 // @desc@ [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
9
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
10 module dstress.run.o.opCast_04_B;
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
11
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
12 struct Dog {
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
13 int i = 1;
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
14 }
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
15
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
16 struct Cat {
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
17 int i = 2;
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
18
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
19 Dog foo() {
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
20 return Dog.init;
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
21 }
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
22
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
23 void bar() {
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
24 Dog d = foo();
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
25 if(d.i != 1){
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
26 assert(0);
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
27 }
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
28 }
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
29 }
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
30
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
31 int main(){
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
32 Cat c;
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
33 c.bar();
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
34 return 0;
8a9ce6778db2 [Issue 686] [Regression] opCast of a struct or union is called in nonsensical circumstances
thomask
parents:
diff changeset
35 }