annotate run/new_08.d @ 1576:b3e16c86558e

[Issue 1398] New: GDC doesn't generate correct code <mariusmuja@gmail.com> 2007-08-04 http://d.puremagic.com/issues/show_bug.cgi?id=1398
author thomask
date Thu, 21 Feb 2008 15:20:08 +0000
parents b3da1b510a19
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
378
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
1 // $HeadURL$
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
2 // $Date$
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
3 // $Author$
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
4
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
5 module dstress.run.new_08;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
6
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
7 int counter;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
8 int counter2;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
9
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
10 class Parent{
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
11 new(size_t size){
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
12 counter++;
889
b3da1b510a19 div. memory management
thomask
parents: 378
diff changeset
13 return (new byte[size]).ptr;
378
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
14 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
15 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
16
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
17 class Child : Parent{
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
18 new(size_t size){
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
19 counter2++;
889
b3da1b510a19 div. memory management
thomask
parents: 378
diff changeset
20 return (new byte[size]).ptr;
378
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
21 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
22 }
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
23
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
24 int main(){
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
25 assert(counter==0);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
26 assert(counter2==0);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
27 Child c = new Child();
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
28 assert(counter==0);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
29 assert(counter2==1);
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
30 return 0;
e555e1460d7e added tests for custom allocators
thomask
parents:
diff changeset
31 }