Thread overview | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
June 09, 2015 [Issue 11044] Escaping references to lazy argument are allowed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Andrei Alexandrescu <andrei@erdani.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version|unspecified |D2 -- |
May 01, 2017 [Issue 11044] Escaping references to lazy argument are allowed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Nick Treleaven <nick@geany.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |safe CC| |nick@geany.org --- Comment #2 from Nick Treleaven <nick@geany.org> --- With dmd 2.074, -dip1000 the `dg = { return i; }` from comment 1 won't compile, but the original lazy code still does. -- |
January 25, 2018 [Issue 11044] Escaping references to lazy argument are allowed | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Carsten Blüggel <chilli@posteo.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chilli@posteo.net -- |
September 21, 2018 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |wrong-code Summary|Escaping references to lazy |Escaping references to lazy |argument are allowed |argument are allowed and | |compile to wrong code Severity|normal |critical --- Comment #3 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- Another test case: ///////////// test.d //////////// @safe: auto toDg(E)(lazy E value) { return { return value; }; } C t; class C { auto getDg() { // return () => prop; return toDg(prop); } final @property string prop() { assert(this is t); return null; } } void smashStack() { int[1024] dummy = 0xcafebabe; } void main() { t = new C(); auto result = t.getDg(); smashStack(); result(); } ///////////////////////////////// The compiler needs to either reject the code (accepts-invalid), or generate a closure (wrong-code). Upgrading severity as this can manifest as a latent bug (depending on whether the stack was overwritten or not) in @safe code. -- |
May 16, 2019 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 ag0aep6g <ag0aep6g@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |simen.kjaras@gmail.com --- Comment #4 from ag0aep6g <ag0aep6g@gmail.com> --- *** Issue 19880 has been marked as a duplicate of this issue. *** -- |
March 04, 2020 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Walter Bright <bugzilla@digitalmars.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |bugzilla@digitalmars.com --- Comment #5 from Walter Bright <bugzilla@digitalmars.com> --- I have a dip in the works to deprecate lazy parameters, replacing them with delegates, precisely because of problems like this. So this particular issue will likely not get fixed. -- |
April 04, 2020 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 --- Comment #6 from Walter Bright <bugzilla@digitalmars.com> --- I recommend in the meantime replacing the lazy parameter with a delegate. -- |
July 14, 2022 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED CC| |razvan.nitu1305@gmail.com Resolution|--- |WONTFIX -- |
January 15, 2023 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Adam D. Ruppe <destructionator@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |destructionator@gmail.com --- Comment #7 from Adam D. Ruppe <destructionator@gmail.com> --- lazy lowers to delegate, so it should be easy to just lower to the right kind of delegate and get correct behavior. There was a dconf online talk about this in 2022. -- |
June 05, 2023 [Issue 11044] Escaping references to lazy argument are allowed and compile to wrong code | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=11044 Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|RESOLVED |REOPENED CC| |dlang-bugzilla@thecybershad | |ow.net Resolution|WONTFIX |--- --- Comment #8 from Vladimir Panteleev <dlang-bugzilla@thecybershadow.net> --- (In reply to Walter Bright from comment #5) > I have a dip in the works to deprecate lazy parameters, replacing them with delegates, precisely because of problems like this. So this particular issue will likely not get fixed. Looks like this was not an easy decision to make, as the situation is unchanged three years later. I think we should at least do something about bugs like this in the meantime - the compiler should either reject such constructs or not generate bad code for them. Personally I am skeptical that lazy can be removed from the language at this point, because for one thing doing so will break std.exception.enforce, and make it impossible to wrap or implement assert in user code. As far as I can see, we have no choice but to support it as part of the language going forward. -- |
Copyright © 1999-2021 by the D Language Foundation