On 6/2/11 11:04 AM, Brad Roberts wrote:
So, is d (and thus dmd) supposed to deal with that case better?  I assume no 
since there's no case 1:, and that the test
should be changed to:
   if (0) switch(1) { A51 a; default: }

In this case a should never be destroyed even on if (1) as no control flow reaches it.

(On another vein, I'm surprised that that ever compiled. In C and C++ I recall it's illegal to have a label followed by no code.)

Of course, the opposite is also interesting in terms of 'in what cases is a 
actually constructed/destructed':
   if (0) switch(1) { default: A51 a; }

Diff looks good to me, and the last line should indeed call two destructors.


Andrei
_______________________________________________
dmd-internals mailing list
[email protected]
http://lists.puremagic.com/mailman/listinfo/dmd-internals

Reply via email to