[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
       
    Sat May  5 13:15:28 UTC 2018
    
    
  
https://issues.dlang.org/show_bug.cgi?id=5931
Johannes Loher <johannes.loher at fg4f.de> changed:
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |johannes.loher at fg4f.de
         Resolution|---                         |WONTFIX
--- Comment #6 from Johannes Loher <johannes.loher at fg4f.de> ---
The first problem mentioned has been solved since 2.063.
The second problem is still present, error message of 2.080.0:
main.d(16): Error: none of the overloads of this are callable using argument
types (File), candidates are:
/usr/include/dlang/dmd/std/stdio.d(387):       
std.stdio.File.this(shared(_IO_FILE)* handle, string name, uint refs = 1u, bool
isPopened = false)
/usr/include/dlang/dmd/std/stdio.d(425):        std.stdio.File.this(string
name, const(char[]) stdioOpenmode = "rb")
/usr/include/dlang/dmd/std/stdio.d(443):        std.stdio.File.__ctor(R1,
R2)(R1 name) if (isInputRange!R1 && isSomeChar!(ElementEncodingType!R1))
/usr/include/dlang/dmd/std/stdio.d(451):        std.stdio.File.__ctor(R1,
R2)(R1 name, R2 mode) if (isInputRange!R1 &&
isSomeChar!(ElementEncodingType!R1) && isInputRange!R2 &&
isSomeChar!(ElementEncodingType!R2))
The reason is in general, that you can't call postblits as if they were
constructors (`File file; auto f = File(file);` also does not work).
However, it seems that postblits will probably be replaced by some form of copy
constructor, so this might even resolve this issue. I will close this for now.
If you really want this feature, please submit a new issue as an enhancement
request.
--
    
    
More information about the Digitalmars-d-bugs
mailing list