www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Re: Behavior of "auto"

reply bearophile <bearophileHUGS lycos.com> writes:
Sean Kelly:
 I'd guess that this is a bug, and is related to the extra work the 
 compiler does for foreach loops.

This is a reduced and simplified version that shows the same thing: class Foo { ~this() { printf("Destroyed\n"); } } void main() { foreach(i; new int[1]) scope Foo f = new Foo(); } Bye, bearophile
Dec 07 2007
parent Sean Kelly <sean f4.ca> writes:
bearophile wrote:
 Sean Kelly:
 I'd guess that this is a bug, and is related to the extra work the 
 compiler does for foreach loops.

This is a reduced and simplified version that shows the same thing: class Foo { ~this() { printf("Destroyed\n"); } } void main() { foreach(i; new int[1]) scope Foo f = new Foo(); }

Please submit a ticket for it if you haven't already :-) Sean
Dec 07 2007