834
|
1 // $HeadURL$
|
|
2 // $Date$
|
|
3 // $Author$
|
|
4
|
|
5 // @author@ Nick <Nick_member@pathlink.com>
|
|
6 // @date@ 2006-02-15
|
|
7 // @uri@ news:dsv036$qlt$1@digitaldaemon.com
|
|
8
|
|
9 // @WARNING@ direct use of Phobos
|
|
10
|
|
11 module dstress.run.d.delete_12_D;
|
|
12
|
|
13 import std.c.stdlib;
|
|
14 import std.outofmemory;
|
|
15 import std.gc;
|
|
16
|
|
17 int status;
|
|
18
|
|
19 class Foo{
|
|
20 int i;
|
|
21
|
|
22 new(size_t sz){
|
|
23 void* p;
|
|
24
|
|
25 p = malloc(sz);
|
|
26
|
|
27 if (!p){
|
|
28 throw new OutOfMemoryException();
|
|
29 }
|
|
30
|
|
31 if(status++ != 1){
|
|
32 assert(0);
|
|
33 }
|
|
34
|
|
35 return p;
|
|
36 }
|
|
37
|
|
38 delete(void* p){
|
|
39 if(status++ != 2){
|
|
40 assert(0);
|
|
41 }
|
|
42 }
|
|
43 }
|
|
44
|
|
45 void test(){
|
|
46 auto Foo f = new Foo();
|
|
47 delete f;
|
|
48 }
|
|
49
|
|
50 int main(){
|
|
51 if(status++ != 0){
|
|
52 assert(0);
|
|
53 }
|
|
54
|
|
55 test();
|
|
56
|
|
57 if(status++ != 3){
|
|
58 assert(0);
|
|
59 }
|
|
60
|
|
61 return 0;
|
|
62 }
|