[Issue 3925] New: Missed escaping reference of a local variable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Mar 10 07:38:57 PST 2010


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

           Summary: Missed escaping reference of a local variable
           Product: D
           Version: 2.041
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Keywords: diagnostic
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2010-03-10 07:38:56 PST ---
This is a wrong program, and the compiler shows the right error messages, of x
and y escaping:


ref int foo(int x) {
    return x;
}
int* baz() {
    int y;
    return &y;
}
void main() {}

-------------------


But in the following case the compiler doesn't show an error:


ref int foo(ref int x) {
    return x;
}
ref int bar() {
    int x;
    return foo(x); // escaping reference of x
}
void main() {}

-- 
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