Created attachment 1645
Source file demonstrating the bug.
Compiling the attached source with dmd -unittest -main bug.d, dmd segfaults.
When line 88 is replaced by line 89 then it compiles and links.
The culprit is an undefined symbol:
Uint128 opCast(T : Uint128)()
{
return ThisTypeDoesNotExistsAndCrahesTheCompiler(v);
}
Changing to
Uint128 opCast(T : Uint128)()
{
return Uint128(0);
}
dmd does not crash.
Comment #1 by ag0aep6g — 2017-05-07T11:32:01Z
(In reply to kai from comment #0)
> Created attachment 1645 [details]
> Source file demonstrating the bug.
Reduced:
----
struct Int128
{
Uint128 opCast()
{
return ThisTypeDoesNotExistsAndCrahesTheCompiler;
}
alias opCast this;
}
struct Uint128
{
Int128 opCast() { return Int128.init; }
alias opCast this;
}
----
Neither this reduction nor the original code compile for me with dmd 2.073.2. So this doesn't seem like a regression in 2.074 to me.