https://issues.dlang.org/show_bug.cgi?id=13526
Issue ID: 13526
Summary: Allow statement: with(auto p = new Panel())
Product: D
Version: D2
Hardware: x86_64
OS: Windows
Status: NEW
Severity: enhancement
Priority: P1
Component: DMD
Assignee: [email protected]
Reporter: [email protected]
Currently this code is not accepted:
with (auto p = new Panel())
{
parent = this;
text = "bla";
with (new Button())
{
parent = p; // Here p is needed
text = "bla2";
}
}
auto is not allowed in with statement. p is needed as parent attribute
of the new button.
One workaround would be to change the coding to:
Panel p;
with (p = new Panel()) {...}
While this coding is working, it seems like a missing feature auto
is not working.
Could you check?
In the discussion
http://forum.dlang.org/thread/[email protected]
also someone mentioned auto would make sense in switch,
but can't judge on that.
--