[Issue 24175] DIP1000 fails to determine proper lifetime for struct
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu Oct 5 19:00:36 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=24175
Dennis <dkorpel at live.nl> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
CC| |dkorpel at live.nl
Resolution|--- |INVALID
--- Comment #1 from Dennis <dkorpel at live.nl> ---
> However, both `a` and `test` should have same lifetime and therefore this code should be allowed
To communicate that, you need to add `return scope` to parameter `data`, or
make the constructor a template function so it's inferred. Otherwise the
constructor could assign the stack allocated slice to a global variable.
--
More information about the Digitalmars-d-bugs
mailing list