Applies at least as far back as DMD1.020; also applies to D2. Discovered while reducing bug 1350. Swapping the order of the two asserts allows it to compile.
==========
void mountainGoat(Callbacks ...)() {
alias Callbacks[0] Cb;
assert(Callbacks[0].ptr);
assert(Cb.ptr);
}
void gazelle() {
mountainGoat!( (int i) { int x = i; } )();
}
Comment #1 by kennytm — 2011-05-31T08:57:53Z
Apparently fixed in 2.053. Not sure about 1.x.
Comment #2 by clugdbug — 2013-04-09T00:37:12Z
To make this compile on D2, needs to be changed so that it's a delegate literal again, instead of a function literal. Passes on D2, still ICE on D1.
Revised test case:
---
void mountainGoat(Callbacks ...)() {
alias Callbacks[0] Cb;
assert(Callbacks[0].ptr);
assert(Cb.ptr);
}
void gazelle() {
int m = 0;
mountainGoat!( (int i) { int x = m + i; } )();
}