I couldn't get this down to less than 3 separate modules, and I can't even guess which part of this is causing the crash.
Compile with -g.
a.d:
```
module a;
struct X {
import b : Baz;
Err err;
}
```
b.d:
```
module b;
struct Baz {
}
struct Qux {
import c;
}
```
c.d:
```
module c;
struct Foo {
import a : X;
X[] x;
}
Nullable!Foo foo() {
Nullable!Foo output;
return output;
}
struct Nullable(T)
{
bool opEquals(U)(const(U) rhs) const
if (is(typeof(this.get == rhs)))
{
return true;
}
inout(T) get() inout
{
return T.init;
}
}
```
Comment #1 by dlang-bot — 2019-03-26T13:42:54Z
@RazvanN7 created dlang/dmd pull request #9495 "Fix Issue 19762 - ICE on invalid code" fixing this issue:
- Fix Issue 19762 - ICE on invalid code
https://github.com/dlang/dmd/pull/9495
Comment #2 by dlang-bot — 2019-03-26T14:56:20Z
dlang/dmd pull request #9495 "Fix Issue 19762 - ICE on invalid code" was merged into stable:
- 1edd0d944e5947ae144d2b1341f7a5fc1dc2c80e by RazvanN7:
Fix Issue 19762 - ICE on invalid code
https://github.com/dlang/dmd/pull/9495
Comment #3 by kinke — 2020-09-27T19:59:31Z
I'm reopening this, as the error msg is ridiculous, and the compiler shouldn't make it to the codegen stage. When making `struct X` a `class X`, there's no codegen with various follow-up issues, and the error msg is much better:
Error: undefined identifier Err, did you mean variable err?
Comment #4 by robert.schadek — 2024-12-13T19:02:41Z