[Issue 23414] Import order emits "Error: no size because of forward references"
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jan 26 21:54:03 UTC 2024
https://issues.dlang.org/show_bug.cgi?id=23414
--- Comment #4 from Walter Bright <bugzilla at digitalmars.com> ---
I would like to fix this, once a smallish test case can be devised. But keep in
mind some things cannot be fixed. At least the compiler issues an error for
those cases. An example:
struct S
{
static if (S.sizeof == 0)
{
int x;
}
}
It's impossible for the compiler to resolve it. While the example looks trivial
and ridiculous, sometimes these cases are hidden behind a thicket of complex
templates.
When module A imports module B, and B also imports A, there's always the
potential for an ordering issue. I try to solve as many as possible, but they
cannot always be fixed. These are commonly the result of two declarations with
a mutual dependence. A solution that works is to refactor A and B so that the
mutually dependent portions are extracted and placed into module C. Then, A and
B import C.
--
More information about the Digitalmars-d-bugs
mailing list