Bug 21459 – @live owned pointer still alive at the end of @live function not detected
Status
RESOLVED
Resolution
FIXED
Severity
major
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
Linux
Creation time
2020-12-07T15:49:55Z
Last change time
2023-01-28T15:28:40Z
Keywords
live
Assigned to
No Owner
Creator
Witold Baryluk
Comments
Comment #0 by witold.baryluk+d — 2020-12-07T15:49:55Z
```
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.
Comment #1 by nick — 2023-01-28T15:20:35Z
Works for me with v2.101.0.
Comment #2 by nick — 2023-01-28T15:28:40Z
run.dlang.io gives:
Since 2.091.1: Failure with output: onlineapp.d(5): Error: variable `onlineapp.kwadrat.num` is left dangling at return