[dmd-internals] runnable/sdtor.d

Brad Roberts braddr at puremagic.com
Thu Jun 2 11:15:06 PDT 2011



On Jun 2, 2011, at 11:05 AM, Walter Bright <walter at digitalmars.com> wrote:

> 
> 
> On 6/2/2011 9:04 AM, Brad Roberts wrote:
>> With the changes to switch to require a default handler, there's some fall-out in runnable/sdtor.d.
>> 
>> line 1271:
>>   if (0) switch(1) A51 a;
>> 
>> runnable/sdtor.d(1271): Error: non-final switch statement must have a default
> 
> I just made it a final switch

Final shouldn't change the error.  The case of 1 isn't handled.

>> +  A51_a = 0; A51 a; with(a) A51 b;                assert(A51_a == 1); // should be 2, right?
>> 
> 
> No, 1. Because 'a' isn't destructed until the end of the scope, which hasn't happened by the the time the assert is called.

Good catch.  Each of those should probably be pushed into an enclosing block.


More information about the dmd-internals mailing list