Copy constructor hell

RazvanN razvan.nitu1305 at gmail.com
Tue May 14 12:11:17 UTC 2019


On Thursday, 9 May 2019 at 04:58:14 UTC, 9il wrote:
> On Wednesday, 8 May 2019 at 18:01:34 UTC, Paul Backus wrote:
>> On Wednesday, 8 May 2019 at 13:19:24 UTC, RazvanN wrote:
>>>
>>> The problems seems to be that the default constructor takes 
>>> the arguments by value so a copy needs to be performed, hence 
>>> the copy constructor use. This is pretty nasty. I will return 
>>> with the details after I sort this out.
>>
>> Isn't the issue that the presence of a constructor disables 
>> the use of "struct literal" syntax [1] for construction? The 
>> compiler is trying to find a constructor that matches the 
>> given argument, but since the only constructor is the 
>> auto-generated copy constructor, it can't.
>>
>
> Yes, exactly. --Ilya

PR: https://github.com/dlang/dmd/pull/9790


More information about the Digitalmars-d mailing list