www.digitalmars.com         C & C++   DMDScript  

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


          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?


import core.stdc.stdlib;


struct Handle
    private void* _handle;

     disable this();
     disable this(this);

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


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 2021