www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 9527] New: Escaping references to variardic parameter array are not properly checked

reply d-bugmail puremagic.com writes:
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 puremagic.com
        ReportedBy: maxim maxim-fomin.ru


--- Comment #0 from Maxim Fomin <maxim 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: -------
Feb 17 2013
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9527


bearophile_hugs eml.cc changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bearophile_hugs eml.cc


--- Comment #1 from bearophile_hugs eml.cc 2013-02-17 14:23:42 PST ---
See also Issue 5212

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
Feb 17 2013
prev sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=9527


Martin Nowak <code dawg.eu> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |code dawg.eu
         Resolution|                            |DUPLICATE


--- Comment #2 from Martin Nowak <code dawg.eu> 2013-04-17 22:47:24 PDT ---
*** This issue has been marked as a duplicate of issue 5212 ***

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