https://issues.dlang.org/show_bug.cgi?id=17977
Dennis <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |Vision CC| |[email protected] Summary|[scope] escaping reference |[DIP1000] destructor allows |to a temporary struct |escaping reference to a |instance |temporary struct instance --- Comment #1 from Dennis <[email protected]> --- The issue description looks incomplete, but I gather this is an accepts-invalid bug in DIP1000 and the comment shows the expected error? Currently I see nothing wrong: `List()` is not scope, and `front()` does not return by ref, so there's no references escaping here. I tried fixing and reducing the code, and I think this is the actual issue: ``` // compile with -preview=dip1000 @safe: struct List { int* data; ~this(); int* front() return; } void test() { auto elem = List().front; } ``` Without the destructor, there's an error: > onlineapp.d(11): Error: address of struct literal `List(null)` assigned > to longer lived variable `elem` Commenting it out makes it go away, which is wrong. --
