https://issues.dlang.org/show_bug.cgi?id=17138
Issue ID: 17138
Summary: Warn about superfluous "with" statements
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
When using:
with(someObject) {
BODY;
}
And none of the expressions within BODY actually use any members of
"someObject", and the destructor of "someObject" is not called at the end of
the "with" statement, it is a likely bug.
I use the following RAII idiom:
with(someLock.acquired()) {
..
}
But get no warning if I accidentally:
with(someLock) {
}
--