[Issue 5931] keyword new won't allow default initialization of a struct where it has a non-zero argument constructor

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 6 12:51:29 PDT 2011


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



--- Comment #4 from kennytm at gmail.com 2011-05-06 12:47:28 PDT ---
(In reply to comment #3)
> *Shouldn't* post-blit be invokable by calling <File(file)>?  Wouldn't this be a
> desirable behavior?
> 

Sorry, got distracted by the 'this.file = new File(...)' part because of your
'File file;' :).

No it should not call post-blit directly, because is possible to *declare* such
a constructor. The problem is, should D define the implicitly-defined copy
constructor which does:

    struct S {
      this(ref S s) {
        this = s;  // implicitly calls the postblit
      }
      ...
    }

?

[snip]
> At the line above marked "DOESN'T WORK", the compiler refuses to allocate a new
> default-initialized File struct.  This is a problem

This problem is the same as issue 4249.

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