This little snippet crashes the compiler (DMD 2.065) on an ASSERT:
dmd: mtype.c:9958: void Parameter::toDecoBuffer(OutBuffer*): Assertion `0' failed.
============
void f(int x, out int y) {}
void g(alias F)(auto ref ParameterTypeTuple!F args) {}
void main() {
int y;
g!f(1, y);
}
============
The issue is that "auto ref" adds 'ref' to y as well, causing a 'ref out' to be inferred, which then fails on an assert in the compiler. Took me half a day to hunt down.
Comment #1 by tomer — 2015-03-19T08:08:46Z
happens on dmd 2.66.1 as well:
void f(int x, out int y) {
}
void g(ref ParameterTypeTuple!f params) {
f(params);
}
dmd: mtype.c:9529: void Parameter::toDecoBuffer(OutBuffer*): Assertion `0' failed.
[1] 14388 abort (core dumped) dmd source/main.d