[Issue 3032] New: No stack allocation for "scope c = new class Object {}; "
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 27 09:22:49 PDT 2009
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: bugzilla at digitalmars.com
ReportedBy: fvbommel at 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: -------
More information about the Digitalmars-d-bugs
mailing list