Bug 9527 – Escaping references to variardic parameter array are not properly checked
Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-02-17T07:44:00Z
Last change time
2013-04-17T22:47:24Z
Keywords
accepts-invalid
Assigned to
nobody
Creator
maxim
Comments
Comment #0 by maxim — 2013-02-17T07:44:54Z
import std.stdio;
class A
{
int[] array;
this(int[] array...)
{
this.array = array;
}
}
A a;
int[] foo(int[] array ...)
{
//return array; //Error: escaping reference to variadic parameter array
a.array = array;
return a.array;
}
int[] bar()
{
return foo(1,2,3);
}
void main()
{
A a = new A(2,3);
}
This should issue two errors: in A ctor and in foo();
Comment #1 by bearophile_hugs — 2013-02-17T14:23:42Z
See also Issue 5212
Comment #2 by code — 2013-04-17T22:47:24Z
*** This issue has been marked as a duplicate of issue 5212 ***