[Issue 9527] New: Escaping references to variardic parameter array are not properly checked

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Feb 17 07:44:56 PST 2013


http://d.puremagic.com/issues/show_bug.cgi?id=9527

           Summary: Escaping references to variardic parameter array are
                    not properly checked
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: accepts-invalid
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: maxim at maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim at maxim-fomin.ru> 2013-02-17 07:44:54 PST ---
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();

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list