Mercurial > projects > dstress
annotate run/new_13.d @ 378:e555e1460d7e
added tests for custom allocators
author | thomask |
---|---|
date | Sat, 02 Apr 2005 10:27:50 +0000 |
parents | |
children | 9e0847cf535a |
rev | line source |
---|---|
378 | 1 // $HeadURL$ |
2 // $Date$ | |
3 // $Author$ | |
4 | |
5 module dstress.run.new_13; | |
6 | |
7 extern(C) void* malloc(size_t size); | |
8 | |
9 int counter; | |
10 | |
11 union MyUnion{ | |
12 int x; | |
13 | |
14 new(size_t size){ | |
15 counter++; | |
16 return malloc(size); | |
17 } | |
18 } | |
19 | |
20 int main(){ | |
21 assert(counter==0); | |
22 MyUnion m; | |
23 m.x=1; | |
24 assert(counter==1); | |
25 return 0; | |
26 } | |
27 |