https://issues.dlang.org/show_bug.cgi?id=22025
Issue ID: 22025
Summary: Exception within a delegate can't be thrown.
Product: D
Version: D2
Hardware: x86_64
OS: Mac OS X
Status: NEW
Severity: critical
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
When throwing an exception within a delegate, the app crashed.
My OS is macOS Big Sur 11.4. It's OK in Linux.
Tested compilers: DMD 2.088.1 - 2.097.0
Here is the sample:
```
void main() {
int factor = 2;
auto ex2a = new Promise!int();
auto ex2b = ex2a.then!(async!((int x) {
if(x == 30) {
// It's a bug in macOS Big Sur 11.4
throw new Exception("throw an exception!");
}
return x * factor;
}));
ex2a.resolve(30); // throw an exception!
}
```
The steps are here for reproducing this bug:
```
$ git clone https://github.com/Heromyth/future.git
$ cd future
$ dub run
```
--