Comment #0 by dlang-bugzilla — 2023-05-06T08:40:18Z
/////////// a.d ///////////
import b : g;
void f()
{
/*static*/ void fun()()
{
}
g!fun();
}
/////////// b.d ///////////
auto g(alias fun)()
{
fun();
}
///////////////////////////
We must specify `static` on `fun` explicitly, otherwise the compilation fails:
b.d(3): Error: function `b.g!(fun).g` cannot access function `fun` in frame of function `a.f`
a.d(5): `fun` declared here
a.d(9): Error: template instance `b.g!(fun)` error instantiating
It looks like, in `a.d`, the compiler knows that `fun` is static, so it does not instantiate `g` with a context pointer. However, when `g` is compiled, it thinks that it needs a context pointer to call `fun`.
One landmark: before 2.065.0, -o- was successful (but -c still failed).
The change happened in https://github.com/dlang/dmd/pull/2705.
Comment #1 by robert.schadek — 2024-12-13T19:28:39Z