digitalmars.D.bugs - [Issue 24175] New: DIP1000 fails to determine proper lifetime for
- d-bugmail puremagic.com (32/32) Oct 05 2023 https://issues.dlang.org/show_bug.cgi?id=24175
https://issues.dlang.org/show_bug.cgi?id=24175 Issue ID: 24175 Summary: DIP1000 fails to determine proper lifetime for struct Product: D Version: D2 Hardware: All OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: grimmaple95 gmail.com Consider the code below: ``` struct A { this(int[] data) safe { a = data; } int[] a; } void main() safe { int[3] test = [1, 2, 3]; A a = A(test); } ``` It fails to compile with dip1000, saying: Error: reference to local variable `test` assigned to non-scope parameter `data` calling `this` However, both `a` and `test` should have same lifetime and therefore this code should be allowed --
Oct 05 2023