June 03, 2011 [Issue 6095] New: switch executes code it shouldn't | ||||
---|---|---|---|---|
| ||||
http://d.puremagic.com/issues/show_bug.cgi?id=6095 Summary: switch executes code it shouldn't Product: D Version: D2 Platform: All OS/Version: All Status: NEW Severity: normal Priority: P2 Component: DMD AssignedTo: nobody@puremagic.com ReportedBy: braddr@puremagic.com --- Comment #0 from Brad Roberts <braddr@puremagic.com> 2011-06-02 23:27:20 PDT --- From runnable/sdtor.d, test 51: int A51_a; struct A51 { ~this() { ++A51_a; } } void test51() // an excerpt from the full test { // should fail to build, no case 1 and no default A51_a = 0; { if (0) final switch(1) A51 a; } assert(A51_a == 0); // should be 0, there's no flow that should involve a being instantiated // or destroyed A51_a = 0; { if (1) switch(1) { A51 a; default: } } assert(A51_a == 1); } -- Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- |
Copyright © 1999-2021 by the D Language Foundation