[Issue 16622] multiple scope(exit) are damaging the stack

2016-10-22 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16622

Mathias Lang  changed:

   What|Removed |Added

 Status|NEW |RESOLVED
 CC||mathias.l...@sociomantic.co
   ||m
 Resolution|--- |WONTFIX

--- Comment #3 from Mathias Lang  ---
The specs explicitly mention you shouldn't do that:

> A scope(exit) or scope(success) statement may not exit with a throw, goto, 
> break, continue, or return; nor may it be entered with a goto.

Ref: http://dlang.org/spec/statement.html#ScopeGuardStatement

It might work in some situations though (happen to work on Linux).
If you think it should always work feel free to bring it up on the N.G. or open
an enhancement request with the rationale.

--


[Issue 16622] multiple scope(exit) are damaging the stack

2016-10-19 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16622

--- Comment #2 from robert...@googlemail.com ---
doesn't matter what is thrown if the stack is corrupted :)

void main() {
scope(exit) {}

scope(exit) {throw new Exception("kab00m!");}; return;
}

--


[Issue 16622] multiple scope(exit) are damaging the stack

2016-10-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=16622

safety0ff.bugz  changed:

   What|Removed |Added

 CC||safety0ff.b...@gmail.com

--- Comment #1 from safety0ff.bugz  ---
Assert(0) is special: https://dlang.org/spec/expression.html#AssertExpression
Do you have a different example?

Code from pastebin:
void main() {
  scope(exit) {}
  scope(exit) {assert(false); };
  return;
}

--