www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 1088] New: structs allocated with a struct allocator will not have default initializer values assigned

reply d-bugmail puremagic.com writes:
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);
}


-- 
Mar 31 2007
next sibling parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=1088






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


-- 
Apr 04 2007
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Jan 08 2011
prev sibling next sibling parent d-bugmail puremagic.com writes:
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



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: -------
Feb 15 2012
prev sibling parent d-bugmail puremagic.com writes:
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



15:40:23 PST ---

 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: -------
Jan 08 2013