Thread overview | |||||||||
---|---|---|---|---|---|---|---|---|---|
|
February 12, 2015 [Issue 9110] Escaping reference error from lazy variadic parameters | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9110 monkeyworks12@hotmail.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |monkeyworks12@hotmail.com --- Comment #1 from monkeyworks12@hotmail.com --- I've also just ran into this error. void test(lazy string[] s...) { } void main(string[] argv) { //Error: escaping reference to local test("asdf", "fdsa", "afsd", "sdaf"); } -- |
May 26, 2015 [Issue 9110] Escaping reference error from lazy variadic parameters | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9110 joeyemmons@yahoo.com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |joeyemmons@yahoo.com --- Comment #2 from joeyemmons@yahoo.com --- Have also hit this... void main(string[] args) { test(a()); } bool a() { return true; } void test(lazy bool[] c...) { } -- |
May 26, 2015 [Issue 9110] Lazy variadic array error message is confusing | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9110 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |schveiguy@yahoo.com Hardware|x86_64 |All Summary|Escaping reference error |Lazy variadic array error |from lazy variadic |message is confusing |parameters | OS|Linux |All --- Comment #3 from Steven Schveighoffer <schveiguy@yahoo.com> --- This bug is invalid. What is happening is this: 1. Because the parameter is a typesafe variadic, the compiler pushes all the data onto the stack. 2. Because the parameter is lazy, instead of passing the data to the function, it creates a delegate to return the typesafe array. In actuality, the data is created inside the delegate. The constructed delegate is the one being flagged for returning a reference to the stack. If you imagine, the delegate looks like this: int[] implicitDelegate() { int[N] arr = [args_to_foo]; return arr[]; // this is the line that is causing the failure. } The correct way to do lazy variadic functions is this: int foo(int delegate()[] dgs...) I'm not going to close this, however. I'm going to repurpose it to change the error message. There is no possible way that the OP's code will or should compile. But the error message is very bad. I'd like to see it say something like: "lazy variadic array parameters are not allowed. Please use a variadic array of delegates". -- |
May 26, 2015 [Issue 9110] Lazy variadic array error message is confusing | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9110 Steven Schveighoffer <schveiguy@yahoo.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic -- |
December 17, 2022 [Issue 9110] Lazy variadic array error message is confusing | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=9110 Iain Buclaw <ibuclaw@gdcproject.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Priority|P2 |P3 -- |
Copyright © 1999-2021 by the D Language Foundation