Comment #0 by verylonglogin.reg — 2012-10-30T07:09:52Z
As static array is a value type, there should be no error:
---
int[2] f(int[2] arr...)
{ return arr; } // Error: escaping reference to variadic parameter arr
---
Comment #1 by john.loughran.colvin — 2015-05-24T19:12:39Z
This is still happening.
Workaround is to create a temporary and hope the compiler elides it.
Comment #2 by dlang-bugzilla — 2017-07-21T05:12:13Z
Test case above no longer fails to compile since 2.074.0 (https://github.com/dlang/dmd/pull/6420), however, adding an indirection to the parameter type still shows the error:
int*[2] f(int*[2] arr...)
{ return arr; }
// Error: returning `arr` escapes a reference to variadic parameter `arr`
Comment #3 by robert.schadek — 2024-12-13T18:02:10Z