[Issue 21459] New: @live owned pointer still alive at the end of @live function not detected

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Dec 7 15:49:55 UTC 2020


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

          Issue ID: 21459
           Summary: @live owned pointer still alive at the end of @live
                    function not detected
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: witold.baryluk+d at gmail.com

```
public:

@live int square(scope const int* num);

@live int kwadrat(int* num) {
    return square(num);
}
```

and

```
public:

@live int square(scope const int* num) {
    return *num * *num;
}

@live int kwadrat(int* num) {
    return square(num);
}

```

should not compile, and emit the error:

<source>(5): Error: variable `example.kwadrat.num` is left dangling at return


But they do compile, and no error is emitted.

DMD 2.094.2 on Linux.

This appears to be a regression. It worked correctly in 2.091, and stopped
working correctly in 2.092.

--


More information about the Digitalmars-d-bugs mailing list