anonymous functions and scope(exit)

Luis Luis.panadero at gmail.com
Sat Jul 3 17:20:47 UTC 2021


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.


More information about the Digitalmars-d-learn mailing list