[Issue 5212] no escape analysis for typesafe variadic function arguments

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 4 09:41:08 UTC 2020


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

Walter Bright <bugzilla at digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|REOPENED                    |RESOLVED
         Resolution|---                         |INVALID

--- Comment #24 from Walter Bright <bugzilla at digitalmars.com> ---
Compiling:
-----
@safe:
class Foo {
    int[] args;
    @safe this(int[] args_...) {
        args = args_;
    }
}
Foo foo() {
    return new Foo(1, 2, 3); // passes stack data to Foo
}
void main() {
    assert(foo().args == [1, 2, 3]);
}
----

with -preview=DIP1000 yields:

  test.d(5): Error: scope variable `args_` assigned to non-scope `this.args`

meaning the compiler is working correctly.

--


More information about the Digitalmars-d-bugs mailing list