[Issue 6095] New: switch executes code it shouldn't
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Jun 2 23:31:46 PDT 2011
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 at puremagic.com
ReportedBy: braddr at puremagic.com
--- Comment #0 from Brad Roberts <braddr at 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: -------
More information about the Digitalmars-d-bugs
mailing list