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

           Summary: No stack allocation for "scope c = new class Object
                    {};"
           Product: D
           Version: 1.044
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Keywords: performance
          Severity: normal
          Priority: P2
         Component: DMD
        AssignedTo: bugzi...@digitalmars.com
        ReportedBy: fvbom...@wxs.nl


(Found in 1.045, but that isn't in the version list)

In the following code 'bar' is heap-allocated even though it's "scope bar = new
...":
-----
void foo() {
    scope bar = new class Object {}; // on heap
}
-----

If the class is given a name then it's stack-allocated:
-----
void foo() {
    class Anon : Object {}
    scope bar = new Anon;            // on stack
}
-----

(Look at the disassembled output to see the difference)

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

Reply via email to