[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 09:57:49 PDT 2010


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


Andrei Alexandrescu <andrei at metalanguage.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |andrei at metalanguage.com


--- Comment #5 from Andrei Alexandrescu <andrei at metalanguage.com> 2010-09-11 09:57:21 PDT ---
(In reply to comment #4)
> (In reply to comment #2)
> > (In reply to comment #1)
> > > Also, since when are structs allowed to be allocated on the heap? TDPL
> > > explicitly states that structs have scoped lifetime.
> > 
> > I double TDPL says this. And if it says so, then it's wrong. TDPL is not a
> > religious book.
> > 
> 
> It's not a religious book, but since the D docs aren't kept up to date, who can
> you trust? And AFAIK Andrei & Walter have both reviewed TDPL and agree with
> what it states there. As for structs on the heap, I simply didn't know it was
> possible to do that, so maybe I judged to quickly from what I've read. 
> 
> Whether it's legal or not is not up to me, so don't take it personal please. :)

Obviously there are many ways to allocate struct objects on the heap: using
new, as members of class objects, or as elements of arrays. All of them are
described in TDPL. If some particular sentence of TDPL seems to rule out such
possibilities please let me know.

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