www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1313] New: out/body disables escape analysis

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

           Summary: out/body disables escape analysis
           Product: D
           Version: 1.010
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: schaouette free.fr


This doesn't compile, and this is _normal_ (Error: escaping reference to local
a):
int[] test()
{
    int a[2];
    return a;
}

But this does compile (DMD 1.01) and should obviously not!
int[] test()
out{}
body
{
    int a[2];
    return a;
}
The problem seems to come from the out section. Removing it raises the compile
time error "Error: escaping reference to local a".

Regards
--
Gilles


-- 
Jul 04 2007