Thread overview
[Issue 1088] New: structs allocated with a struct allocator will not have default initializer values assigned
Apr 01, 2007
d-bugmail
Apr 04, 2007
d-bugmail
Feb 16, 2012
yebblies
Jan 08, 2013
Andrej Mitrovic
April 01, 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@digitalmars.com
        ReportedBy: guido@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);
}


-- 

April 04, 2007
http://d.puremagic.com/issues/show_bug.cgi?id=1088





------- Comment #1 from thomas-dloop@kuehne.cn  2007-04-04 15:36 -------
Added to DStress as http://dstress.kuehne.cn/run/s/struct_initialization_10_A.d http://dstress.kuehne.cn/run/s/struct_initialization_10_B.d


-- 

January 08, 2011
http://d.puremagic.com/issues/show_bug.cgi?id=1088


Andrei Alexandrescu <andrei@metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei@metalanguage.com
            Version|1.010                       |D1


--- Comment #2 from Andrei Alexandrescu <andrei@metalanguage.com> 2011-01-08 13:03:56 PST ---
D1 only - D2 will eliminate custom operator new.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
February 16, 2012
http://d.puremagic.com/issues/show_bug.cgi?id=1088


yebblies <yebblies@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |yebblies@gmail.com
         Resolution|                            |WORKSFORME


--- Comment #3 from yebblies <yebblies@gmail.com> 2012-02-16 17:32:17 EST ---
These all seem to work, in D1 and D2 (1.072, 2.058)

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
January 08, 2013
http://d.puremagic.com/issues/show_bug.cgi?id=1088


Andrej Mitrovic <andrej.mitrovich@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrej.mitrovich@gmail.com


--- Comment #4 from Andrej Mitrovic <andrej.mitrovich@gmail.com> 2013-01-08 15:40:23 PST ---
(In reply to comment #2)
> D2 will eliminate custom operator new.

If this is going to happen we should implement a deprecation stage (initially add a note to the docs, then the compiler can eventually emit a warning, and later reject such code).

We've lost 2 years which could have been used to deprecate the feature.

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