D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 23380 - [dip1000] class parameter should not be treated as ref qua lifetime
Summary: [dip1000] class parameter should not be treated as ref qua lifetime
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P1 normal
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-09-28 11:19 UTC by Dennis
Modified: 2022-09-29 15:21 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Dennis 2022-09-28 11:19:00 UTC
This should pass:
```
@safe void test(scope Object o0, scope Object o1)
{
    o1 = o0; // Error: scope variable `o0` assigned to `o1` with longer lifetime
}
```

It doesn't because dmd currently considers o1 a `ref` parameter qua lifetime.
Comment 1 Dennis 2022-09-29 15:21:24 UTC
Fixed by https://github.com/dlang/dmd/pull/14495