consider the following code
```d
noreturn v(int a)
{
scope(exit) a++; // cant be executed
{
scope(exit) a++; // this one is okay
}
assert(0);
}
```
There should be a sema error for the first scope guard as the defered expression statement cannot be executed.
Comment #1 by elpenguino+D — 2024-03-29T07:18:37Z
I don't think it's accurate to do that for all noreturn scopes. Consider:
```
noreturn v(int a) {
scope(exit) a++;
{
scope(exit) a++;
}
throw new Exception("Exception");
}
```
In this code, both scope guards should be executed.
Comment #2 by robert.schadek — 2024-12-13T19:34:17Z