[Issue 17138] New: Warn about superfluous "with" statements
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Thu Feb 2 06:40:00 PST 2017
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: nobody at puremagic.com
Reporter: eyal at weka.io
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) {
}
--
More information about the Digitalmars-d-bugs
mailing list