www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 21923] New: live is not detect destructor

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

          Issue ID: 21923
           Summary:  live is not detect destructor
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Windows
            Status: NEW
          Keywords: live
          Severity: minor
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: lempiji gmail.com

Hi, I want fully  live annotated library.

I had hoped that this code would detect RAII correctly.
If it is not supported, then I think the compiler should ignore this error.

How about it?

https://run.dlang.io/is/cIHt7V

```
import core.stdc.stdlib;

 live:

struct Handle
{
    private void* _handle;

     disable this();
     disable this(this);

    this(int n)
    {
        _handle = malloc(n);
    }

    ~this()
    {
        free(_handle);
    }
}

void main()
{
    auto t = Handle(10); // The result is the same even if it is `scope`
}
```

```
onlineapp.d(25): Error: variable `onlineapp.main.t` is left dangling at return

```

--
May 15