anonymous functions and scope(exit)

frame frame86 at live.com
Sat Jul 3 17:35:12 UTC 2021


On Saturday, 3 July 2021 at 17:20:47 UTC, Luis wrote:
> This is intentional ?
>
> ```
>         should(function void() {
>             auto emptyStack = SimpleStack!int();
>             scope(exit) emptyStack.free; // <= This is never 
> called
>
>             emptyStack.reserve(16);
>             emptyStack.top;
>         }).Throw!RangeError;
> ```
>
> scope(exit) inside of a anonymous functions, it's never called.

Please provide an example code. What lib is this? Normally 
scope(exit) works also for anonymous functions.


More information about the Digitalmars-d-learn mailing list