www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - [ HELP ] fakePureCalloc error

reply wron <wron mail.com> writes:
Hey guys, what does this error mean:
`.local/usr/dmd-2.111.0/linux/bin64/../../src/phobos/std/inter
al/memory.d(39,33): Error: `fakePureCalloc` cannot be interpreted at compile
time, because it has no available source code`

I have a class:
```
import std.container.array : Array;

class Sieve(K, V)
{
     alias kvtuple = Tuple!(K, V);
     struct cdata
     {
         kvtuple data;
         cdata* prev;
         cdata* next;
         bool visited;
     }

     cdata* head, tail, hand;
     Array!(cdata) arr;
     int count, len;

     this(int l = 1021)
     {
         len = l;
         arr.length(len);
     }

     ... do more things
}

````
works when I do:
```
Sieve!(string, int) sieve = new Sieve!(string, int); 
sieve.arr.length(1021);
```
and remove the constructor.
Oct 19
parent "H. S. Teoh" <hsteoh qfbox.info> writes:
On Sun, Oct 19, 2025 at 07:54:53AM +0000, wron via Digitalmars-d-learn wrote:
 Hey guys, what does this error mean:
 `.local/usr/dmd-2.111.0/linux/bin64/../../src/phobos/std/inter
al/memory.d(39,33): Error: `fakePureCalloc` cannot be interpreted at compile
time, because it has no available source code`
[...] Don't use `Array!(...)` in compile-time code. Just use a regular array. T -- How many guacas are in 1 guacamole? 6.022*10^23, also known as Avocado's Number.
Oct 19