`static` function ... cannot access variable in frame of ...
H. S. Teoh
hsteoh at qfbox.info
Mon Jan 15 18:34:58 UTC 2024
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
--
It is of the new things that men tire --- of fashions and proposals and improvements and change. It is the old things that startle and intoxicate. It is the old things that are young. -- G.K. Chesterton
More information about the Digitalmars-d-learn
mailing list