https://issues.dlang.org/show_bug.cgi?id=13508

--- Comment #6 from Kenji Hara <[email protected]> ---
(In reply to hsteoh from comment #1)
> Array vararg functions are not safe, because they take a slice of arguments
> on the stack. Example problem:
> -----
> class C {
>     int[] data;
>     this(int[] args...) {
>         data = args; // oops: this.data now points to the stack...
>     }
> }
> -----

I think that typesafe variadic parameters would be designed to be safe, because
the following case is correctly rejected by the compile time check.

int[] foo(int[] args...) {
    return args;    // Error: escaping reference to variadic parameter args
}

But as you know, current escape analysis mechanism is incomplete, and scope
attribute is yet not defined well.

--

Reply via email to