[Issue 22654] New: AST for UDA annotated struct with destructor does not run destructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri Jan 7 04:15:12 UTC 2022


https://issues.dlang.org/show_bug.cgi?id=22654

          Issue ID: 22654
           Summary: AST for UDA annotated struct with destructor does not
                    run destructor
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: iamthewilsonator at hotmail.com

```
enum someUDA;
struct S { ~this() { writeln("~S"); } }
void main()
{
  auto correct = S();
  @someUDA auto bug = S();
}
```

with DMD prints
~S
~S 
as expected, but the AST verified with -vcg_ast lack an additional try block
and destructor call for `bug` and LDC prints
~S
as expected for the AST. DMD is doing something very strange here.

--


More information about the Digitalmars-d-bugs mailing list