[Issue 13899] New: Unwanted warning for pure opApply
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sat Dec 27 07:57:00 PST 2014
https://issues.dlang.org/show_bug.cgi?id=13899
Issue ID: 13899
Summary: Unwanted warning for pure opApply
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: diagnostic
Severity: minor
Priority: P1
Component: DMD
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
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
--
More information about the Digitalmars-d-bugs
mailing list