1 // PERMUTE_ARGS:
2 
3 module testgc2;
4 
5 import core.stdc.stdio;
6 import core.exception : OutOfMemoryError;
7 
8 /*******************************************/
9 
10 void test1()
11 {
12     printf("This should not take a while\n");
13     try
14     {
15         long[] l = new long[ptrdiff_t.max];
16         printf("%lu\n", cast(ulong)l.capacity); // Make sure l is not optimized out.
17         assert(0);
18     }
19     catch (OutOfMemoryError o)
20     {
21     }
22 
23     printf("This may take a while\n");
24     try
25     {
26         byte[] b = new byte[size_t.max / 3];
27         printf("%lu\n", cast(ulong)b.capacity); // Make sure b is not optimized out.
28         version (Windows)
29             assert(0);
30     }
31     catch (OutOfMemoryError o)
32     {
33     }
34 }
35 
36 /*******************************************/
37 
38 void main()
39 {
40     test1();
41 
42     printf("Success\n");
43 }
44 
45