Comment #0 by bearophile_hugs — 2014-12-27T15:57:00Z
I think the compiler should not generate a warning in this case:
const struct Foo {
int opApply(immutable int delegate(in ref int) pure nothrow dg)
pure nothrow {
return 1;
}
}
void main() {
foreach (x; Foo()) {}
}
dmd 2.067alpha gives:
test.d(7,5): Warning: calling test.Foo.opApply without side effects discards return value of type int, prepend a cast(void) if intentional