hi. the following (manually "dustmited" ;-)) code gives the error from subj on git HEAD:
=== ztest.d ===
module ztest;
auto streamAsRange(STP) (STP st) {
static struct StreamRange(ST) {
private:
ST strm;
public:
void put (const(ubyte)[] data) { strm.rawWrite(data); }
}
return StreamRange!STP();
}
void zcompress(RO) (RO ro) {
ubyte[1] obuf;
void writeOBuf () {
static if (is(typeof(() {
ubyte[2] b;
ro.put(b);
}))) {
ro.put(obuf);
}
}
writeOBuf();
}
void test () {
import std.stdio;
auto fo = File();
zcompress(streamAsRange(fo));
}
void main () {
}
======
the strange thing is that this is heisenbug. if i comment out `static if`
the module successfully compiles. i.e. changing `zcompress()` to this
allows me to compile the code:
===
void zcompress(RO) (RO ro) {
ubyte[1] obuf;
void writeOBuf () {
ro.put(obuf);
}
writeOBuf();
}
===
so the offending line is `ro.put(b);` (comment it out, and everything is
working again).
am i doing something very wrong here, or this is really a compiler bug?
signature.asc
Description: PGP signature
