`static` function ... cannot access variable in frame of ...
user1234
user1234 at 12.de
Mon Jan 15 22:29:59 UTC 2024
On Monday, 15 January 2024 at 18:34:58 UTC, H. S. Teoh wrote:
> On Mon, Jan 15, 2024 at 06:16:44PM +0000, Bastiaan Veelo via
> Digitalmars-d-learn wrote:
>> Hey people, I can use some help understanding why the last
>> line produces a compile error.
>>
>> ```d
>> import std.stdio;
>>
>> struct S
>> {
>> static void foo(alias len)()
> [...]
>
> The trouble is with the `static` here. A context pointer is
> necessary in order to have access to the context of main() from
> the body of this function; but `static` precludes this
> possibility.
>
>
> T
I dont agree, problem is S_foo that get automagically
monomorphized in `main` scope.
That's a very classic D problem.
More information about the Digitalmars-d-learn
mailing list