[Issue 4247] Cannot create default-constructed struct on heap when constructor is defined

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Sep 11 06:37:32 PDT 2010


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


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

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


--- Comment #1 from Andrej Mitrovic <andrej.mitrovich at gmail.com> 2010-09-11 06:37:01 PDT ---
You can't make your own default constructor for structs, this is explained in
TDPL. A constructor with no arguments is created by default, with each field of
a struct initialized to it's type's .init property. You cannot override this.
See page 244 in TDPL.

Also, since when are structs allowed to be allocated on the heap? TDPL
explicitly states that structs have scoped lifetime.

-- 
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