"...cannot be interpreted at compile time" I can't find the source of the error!

Pablo De Nápoli nospam at dev.null
Fri Aug 20 03:04:26 UTC 2021


On Friday, 20 August 2021 at 02:51:16 UTC, jfondren wrote:
> On Friday, 20 August 2021 at 02:30:53 UTC, Pablo De Nápoli 
> wrote:
>> Any idea of which could be the cause of trouble or on how to 
>> get more specific 	diagnosis?
>
> With no extra arguments I get a "compile time context created 
> here" addendum. Does that not show up for you or does the line 
> not make sense still?
>
> It might also be new. This is with v2.097.1
>
> ```
> example.d(6): Error: `atoi` cannot be interpreted at compile 
> time, because it has no available source code
> example.d(12):        compile time context created here
> example.d(13): Error: no property `val` for type `void`
> ```
>
> From this code:
>
> ```d
> extern (C) int atoi(const(char)* nptr);
>
> class N {
>     int val;
>     this() {
>         val = atoi("2");
>     }
> }
>
> void main() {
>     import std.stdio : writeln;
>     enum n = new N(); // line 12
>     writeln(n.val);
> }
> ```

Many thanks!. I'm using the same version of the compiler.
Without arguments, I get

mpdec/decimal.d(35,20): Error: `mpd_new` cannot be interpreted at 
compile time, because it has no available source code
Error: cannot interpret `<error>` at compile time
mpdec/decimal.d(35,20): Error: `mpd_new` cannot be interpreted at 
compile time, because it has no available source code


Nothing like

"compile time context created here"

(this is what I would need to trace the error!)



More information about the Digitalmars-d-learn mailing list