[Issue 1088] New: structs allocated with a struct allocator will not have default initializer values assigned
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Mar 31 17:20:57 PDT 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1088
Summary: structs allocated with a struct allocator will not have
default initializer values assigned
Product: D
Version: 1.010
Platform: All
OS/Version: All
Status: NEW
Severity: major
Priority: P2
Component: DMD
AssignedTo: bugzilla at digitalmars.com
ReportedBy: guido at grumpy-cat.com
/*
* dmd -w -O dtest.d
* ./dtest
* static_foo.a = 800
* dynamic_foo.a = 100
*/
import std.stdio;
int storage = 100;
struct foo {
new(uint size, void* p) {
return p;
}
int a = 800;
}
void main() {
foo static_foo;
writefln("static_foo.a = %d", static_foo.a);
foo* dynamic_foo = new(&storage) foo;
writefln("dynamic_foo.a = %d", dynamic_foo.a);
}
--
More information about the Digitalmars-d-bugs
mailing list