Thread overview |
---|
July 25, 2019 [Issue 20084] return by auto ref unsafe - and different code for inout ref and ref. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20084 kinke <kinke@gmx.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |kinke@gmx.net Hardware|x86 |All OS|Mac OS X |All Severity|enhancement |normal --- Comment #1 from kinke <kinke@gmx.net> --- With `-dip1000`, get() returns a reference, just like inoutGet(). Even this compiles with `-dip1000 -dip25` but clearly reads beyond the stack: ----- @safe: struct W(T) { T value; ref T front() return { return value; } } ref get(T)(W!T value) { return value.front; } void foo() { int i = get(W!int(4)); } ----- -- |
July 25, 2019 [Issue 20084] return by auto ref unsafe - and different code for inout ref and ref. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20084 ag0aep6g <ag0aep6g@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |accepts-invalid, safe CC| |ag0aep6g@gmail.com -- |
July 25, 2019 [Issue 20084] return by auto ref unsafe - and different code for inout ref and ref. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20084 --- Comment #2 from Ali Ak <ali.akhtarzada@gmail.com> --- (In reply to Ali Ak from comment #0) > But why does ref T return by ref? *by value > auto ref get(Range)(Range range) { > return range.front; > } I meant: auto ref get(Range)(auto ref Range range) { return range.front; } -- |
March 14, 2020 [Issue 20084] return by auto ref unsafe - and different code for inout ref and ref. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20084 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #3 from Walter Bright <bugzilla@digitalmars.com> --- Reduced test case: struct W() { int value; @safe ref int front() return { return value; } } @safe ref int get(W!() v) { return v.front; // should produce error message with -dip1000 } -- |
March 14, 2020 [Issue 20084] return by auto ref unsafe - and different code for inout ref and ref. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20084 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |pull --- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> --- @WalterBright created dlang/dmd pull request #10915 "fix Issue 20084 - return by auto ref unsafe - and different code for …" fixing this issue: - fix Issue 20084 - return by auto ref unsafe - and different code for inout ref and ref https://github.com/dlang/dmd/pull/10915 -- |
March 14, 2020 [Issue 20084] return by auto ref unsafe - and different code for inout ref and ref. | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=20084 Dlang Bot <dlang-bot@dlang.rocks> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution|--- |FIXED --- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> --- dlang/dmd pull request #10915 "fix Issue 20084 - return by auto ref unsafe - and different code for …" was merged into master: - a299e32a89e6dabfcc35fb4be063c9902832f508 by Walter Bright: fix Issue 20084 - return by auto ref unsafe - and different code for inout ref and ref https://github.com/dlang/dmd/pull/10915 -- |
Copyright © 1999-2021 by the D Language Foundation