D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 1313 - out/body disables escape analysis
Summary: out/body disables escape analysis
Status: RESOLVED FIXED
Alias: None
Product: D
Classification: Unclassified
Component: dmd (show other issues)
Version: D2
Hardware: All All
: P2 normal
Assignee: No Owner
URL:
Keywords: accepts-invalid, patch
: 7272 (view as issue list)
Depends on:
Blocks:
 
Reported: 2007-07-04 07:22 UTC by Gilles G.
Modified: 2015-06-09 05:11 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Gilles G. 2007-07-04 07:22:40 UTC
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
Comment 1 Kenji Hara 2012-01-12 20:26:32 UTC
2.058head has same problem, so this is D1 & D2 issue.

D2 patch:
https://github.com/D-Programming-Language/dmd/pull/617
Comment 2 Kenji Hara 2012-01-12 20:29:56 UTC
*** Issue 7272 has been marked as a duplicate of this issue. ***