[Issue 8269] The 'with statement' does not observe temporary object lifetime
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Fri Aug  8 23:04:24 PDT 2014
    
    
  
https://issues.dlang.org/show_bug.cgi?id=8269
yebblies <yebblies at gmail.com> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull
           Assignee|nobody at puremagic.com        |yebblies at gmail.com
--- Comment #12 from yebblies <yebblies at gmail.com> ---
It is how it expands itself.
with(exp) {...} gets re-written to
with(auto tmp = exp, tmp) {...}
and then
with(auto withptr = &(auto tmp = exp, tmp)) {...}
which ends up looking like
auto withptr = &(auto tmp = exp, tmp)
...
in the glue layer.  Since tmp is local to the expression, the dtor code is
inserted right after it.
https://github.com/D-Programming-Language/dmd/pull/3855
--
    
    
More information about the Digitalmars-d-bugs
mailing list