June 22, 2023
https://issues.dlang.org/show_bug.cgi?id=24010

          Issue ID: 24010
           Summary: Destructor called before end of scope for tuples
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: critical
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: johanengelen@weka.io

Testcase:
```
alias AliasSeq(TList...) = TList;

import core.stdc.stdio;

int i = 0;
struct A {
    ~this() {
        printf("~this\n");
        i *= 2;
    }
}

void main() {
    {
        AliasSeq!(A, A) params;
        printf("statement\n");
        i = 1;
    }
    printf("%d\n", i);
    assert(i == 4);
}
```

The assertion fails.
Looking at the printout:
```
~this
~this
statement
1
```
you can see that the dtors are called before the statement `i = 1;`, instead of
at the end of the scope.

--