annotate run/d/delegate_17_A.d @ 1630:d0efa3ae5522 default tip

run/mini/naked_asm5: New x86_64 ABI passes the arguments in reverse order.
author David Nadlinger <code@klickverbot.at>
date Sat, 23 Apr 2011 22:57:32 +0200
parents 81222734adf3
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1036
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
1 // $HeadURL$
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
2 // $Date$
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
3 // $Author$
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
4
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
5 // @author@ <sky@quit-clan.de>
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
6 // @date@ 2006-05-24
1319
81222734adf3 sed'ed replacement of new:...http.d.puremagic.co... with http://d.puremagic.com/issues/show_bug.cgi?...
thomask
parents: 1091
diff changeset
7 // @uri@ http://d.puremagic.com/issues/show_bug.cgi?id=155
1036
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
8
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
9 module dstress.run.d.delegate_17_A;
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
10
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
11 int status;
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
12
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
13 class Foo{
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
14 class Bar{
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
15 int delegate() getDelegate(){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
16 return &sayHello;
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
17 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
18 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
19 Bar bar;
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
20
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
21 int sayHello(){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
22 return ++status;
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
23 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
24
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
25 this(){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
26 bar = new Bar();
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
27 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
28 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
29
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
30 int main(){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
31 Foo foo = new Foo();
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
32 int delegate() hallo;
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1036
diff changeset
33
1036
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
34 hallo = foo.bar.getDelegate();
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
35
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
36 if(!hallo){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
37 assert(0);
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
38 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
39 if(status != 0){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
40 assert(0);
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
41 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
42 if(hallo() != 1){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
43 assert(0);
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
44 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
45 if(status != 1){
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
46 assert(0);
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
47 }
1091
9dcac8d4e97f post DMD-0.163 review
thomask
parents: 1036
diff changeset
48
1036
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
49 return 0;
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
50 }
8006b20664ca Nested classes can't return delegates to their parents
thomask
parents:
diff changeset
51