Executing dub build for https://github.com/andre2007/delta-core-10-2-1.git fails with compiler bug for 2.081.1. It works fine with 2.080.0
I used dustmite to reduce it to:
--- app.d
template GenEvent(string eventName, T)
{
const char[] GenEvent =
`private `~T.stringof~` _`~eventName~`;`~
T.stringof~eventName~`(`~T.stringof~` value) {
import std.utf: toUTFz;
import core.sys.windows.windows;
_`~eventName~`= value;
auto dlg = __traits(getOverloads, this, "`~eventName~`");
FARPROC fp = GetProcAddress(deltaLibrary.handle, "registerNotifyEvent");
Fn fn = cast(Fn) fp;
fn(this.reference, pChar, cast(int) dlg.ptr, cast(int) dlg.funcptr, bindDelegate(dg));
}
@property `~eventName~`() {
return _`~`;
}`;
}
auto bindDelegate() {
}
alias TNotifyEvent = void delegate();
class TBasicAction{
mixin(GenEvent!("OnExecute", TNotifyEvent));
}
void main()
{
}
---
Executing dmd app.d with 2.081.1 returns compiler bug.
Executing it with 2.080.0 returns syntax errors which is expected
as dustmite changed too much. But for analyzing the compiler bug,
this should be fine.
Comment #1 by slavo5150 — 2018-08-10T00:36:38Z
Further reduced:
alias TNotifyEvent = void delegate();
class TBasicAction
{
private TNotifyEvent _OnExecute;
TNotifyEvent OnExecute(TNotifyEvent value)
{
auto dlg = __traits(getOverloads, this, "OnExecute");
}
}
Results in segmentation fault in traits.d
Comment #2 by slavo5150 — 2018-08-10T00:50:29Z
Further reduction to something that will compile successfully when the bug is fixed.
class TBasicAction
{
int OnExecute()
{
auto name = __traits(getOverloads, this, "OnExecute").stringof;
return 0;
}
}
void main() {}
*** Issue 19170 has been marked as a duplicate of this issue. ***
Comment #6 by dlang-bot — 2021-01-03T22:57:18Z
dlang/dmd pull request #12093 "[dmd-cxx] Backport more recent traits to the C++ port" was merged into dmd-cxx:
- 00a80d5e38f32cf4ff5b7fe8058c5be42067f286 by JinShil:
[dmd-cxx] Fix Issue 19152 - 2.081.1 Regression - Seg fault in traits.c
https://github.com/dlang/dmd/pull/12093