This never ends:
---
struct Conv
{
static StaticIterable b;
alias b this;
}
struct StaticIterable
{
static Conv b; alias b this;
static void popFront() { }
static bool empty() { return true; }
static int front() { return 0; }
}
void main()
{
import std.algorithm;
StaticIterable.each!(a => 0);
}
---
Possibly rather a problem in phobos.
Comment #1 by b2.temp — 2021-05-07T23:46:07Z
reduced:
---
struct Conv
{
static StaticIterable b;
alias b this;
}
struct StaticIterable
{
static Conv b;
alias b this;
}
void each(T)(ref T r)
{
return ;
}
void main()
{
StaticIterable.each!();
}
---
Comment #2 by b2.temp — 2021-05-08T00:06:11Z
the loop is fixed with the most recent versions but it seems that valid code get rejected:
---
struct Conv
{
StaticIterable b;
alias b this;
}
struct StaticIterable
{
static Conv b;
alias b this;
}
void each(ref StaticIterable r)
{
return ;
}
void main()
{
StaticIterable s;
each(s);
}
---
Comment #3 by dlang-bot — 2021-05-08T00:26:55Z
@TungstenHeart created dlang/dmd pull request #12503 "fix 21905 - case of IFTI failure when combining `ref`, and `alias this` on a static instance" fixing this issue:
- fix 21905 - case of IFTI failure when combining `ref`, and `alias this` on a static instance
https://github.com/dlang/dmd/pull/12503
Comment #4 by dlang-bot — 2021-07-07T13:46:16Z
@ibuclaw updated dlang/dmd pull request #12798 "Issue 21488 - Always compile dmd with -fPIC on POSIX targets" fixing this issue:
- fix 21905 - case of IFTI failure when combining `ref`, and `alias this` on a static instance
https://github.com/dlang/dmd/pull/12798