www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 22654] New: AST for UDA annotated struct with destructor does

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 puremagic.com
          Reporter: iamthewilsonator 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.

--
Jan 06 2022