digitalmars.D.bugs - [Issue 1087] New: Scope classes not destroyed in labeled statements in switches
- d-bugmail puremagic.com (56/56) Mar 30 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1087
- d-bugmail puremagic.com (12/12) Apr 05 2007 http://d.puremagic.com/issues/show_bug.cgi?id=1087
- d-bugmail puremagic.com (13/13) Mar 19 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1087
- d-bugmail puremagic.com (12/12) Sep 16 2009 http://d.puremagic.com/issues/show_bug.cgi?id=1087
- d-bugmail puremagic.com (12/12) May 28 2010 http://d.puremagic.com/issues/show_bug.cgi?id=1087
http://d.puremagic.com/issues/show_bug.cgi?id=1087
Summary: Scope classes not destroyed in labeled statements in
switches
Product: D
Version: 1.010
Platform: PC
OS/Version: Windows
Status: NEW
Severity: normal
Priority: P2
Component: DMD
AssignedTo: bugzilla digitalmars.com
ReportedBy: jarrett.billingsley gmail.com
Have a look:
scope class A
{
~this()
{
writefln("A dtor");
}
}
void main()
{
int x = 5;
switch(x)
{
case 5:
scope a = new A();
scope(exit) writefln("exit");
writefln("five");
break;
}
switch(x)
{
case 5:
goto _something;
_something:
scope a = new A();
scope(exit) writefln("exit");
writefln("something");
break;
}
}
This outputs:
five
exit
A dtor
something
exit
You'll notice the first switch works correctly -- "five", then "exit", then "A
dtor" are printed, as expected. But the second switch jumps to a label (common
when you have several cases which have a common ending code) inside the switch.
In this case, the scope(exit) statement prints "exit", but the scope class's
dtor is never called.
Related to 1041?
--
Mar 30 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1087
thomas-dloop kuehne.cn changed:
What |Removed |Added
----------------------------------------------------------------------------
OS/Version|Windows |All
Added to DStress as
http://dstress.kuehne.cn/run/s/scope_17_A.d
http://dstress.kuehne.cn/run/s/scope_17_B.d
http://dstress.kuehne.cn/run/s/scope_17_C.d
http://dstress.kuehne.cn/run/s/scope_17_D.d
--
Apr 05 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1087
import std.stdio;
void main() {
start: // Comment this line.
scope(exit)
writefln("exit");
writefln("Got Here");
}
'exit' is not output if start: label is present.
C:\> test
Got Here
--
Mar 19 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1087
Don <clugdbug yahoo.com.au> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |clugdbug yahoo.com.au
Summary|Scope classes not destroyed |scope(exit) is ignored if
|in labeled statements in |preceded by a label
|switches |
Severity|normal |critical
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Sep 16 2009
http://d.puremagic.com/issues/show_bug.cgi?id=1087
Walter Bright <bugzilla digitalmars.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |bugzilla digitalmars.com
Resolution| |DUPLICATE
21:38:56 PDT ---
*** This issue has been marked as a duplicate of issue 1894 ***
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
May 28 2010









d-bugmail puremagic.com 