Thread overview | ||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
April 27, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 ag0aep6g <ag0aep6g@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid, safe CC| |ag0aep6g@gmail.com -- |
June 03, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |dkorpel@live.nl --- Comment #1 from Dennis <dkorpel@live.nl> --- Here's it reduced some more: ``` struct S { int buf; int* ptr; // <= required } int* getPtr(ref return scope S this_) { return &this_.buf; } ``` Since getPtr does not return by `ref`, the `return scope` applies to the members of `S` and not the `ref this_` itself. The compiler checks whether `&this_.buf;` is escaped by value. In `visit(AddrExp e)` of escape.d, it reduces this to checking whether `this_.x` escapes by ref, which reduces to checking whether `this_` escapes by ref. Then it looks at the parameter's storage classes, and sees `return`, so it allows it. This is wrong, the `return` does not apply to `&this_.x`, only to `this_.buf`; Without the `buf` member, S has no pointers, so the `return scope` attribute is meaningless, so it is stripped away at some earlier stage. This way the compiler can't mistake it for a `ref return`, so it raises an error. I'm still trying to grasp the incredibly difficult logic in escape.d so I'm not sure how to fix this yet. -- |
June 03, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 --- Comment #2 from Dennis <dkorpel@live.nl> --- > This is wrong, the `return` does not apply to `&this_.x`, only to `this_.buf`; I should be careful when renaming variables :) Corrections: * reduces this to checking whether `this_.buf` escapes by ref * This is wrong, the `return` does not apply to `&this_.buf`, only to `this_.ptr`; -- |
June 10, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #3 from Dlang Bot <dlang-bot@dlang.rocks> --- @dkorpel created dlang/dmd pull request #12665 "Fix issue 21868 - conflation of return-ref and return-scope" fixing this issue: - fix issue 21868 - conflation of return-ref and return-scope https://github.com/dlang/dmd/pull/12665 -- |
June 10, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |per.nordlow@gmail.com --- Comment #4 from Dennis <dkorpel@live.nl> --- *** Issue 18792 has been marked as a duplicate of this issue. *** -- |
June 18, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 Dennis <dkorpel@live.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=22040 -- |
July 06, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> --- Minimized test case: ref int test(ref scope return int* p) { return *p; } -- |
July 06, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 --- Comment #6 from Dlang Bot <dlang-bot@dlang.rocks> --- @WalterBright created dlang/dmd pull request #12817 "fix Issue 21868 - DIP1000 doesn't catch pointer to struct temporary" fixing this issue: - fix Issue 21868 - DIP1000 doesn't catch pointer to struct temporary https://github.com/dlang/dmd/pull/12817 -- |
July 07, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 --- Comment #7 from Walter Bright <bugzilla@digitalmars.com> --- (In reply to Walter Bright from comment #5) > Minimized test case: > > ref int test(ref scope return int* p) > { > return *p; > } This is a separate bug, so moved to: https://issues.dlang.org/show_bug.cgi?id=22108 -- |
July 07, 2021 [Issue 21868] DIP1000 doesn't catch pointer to struct temporary | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=21868 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- See Also| |https://issues.dlang.org/sh | |ow_bug.cgi?id=22108 -- |
Copyright © 1999-2021 by the D Language Foundation