Possible bug in RVO?

Yuxuan Shui via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Apr 3 20:57:18 PDT 2016


On Monday, 4 April 2016 at 03:55:26 UTC, Yuxuan Shui wrote:
> On Monday, 4 April 2016 at 03:28:01 UTC, Yuxuan Shui wrote:
>> I have encountered a weird bug.
>>
>> I defined a Set class, which has a opBinary!"-". And somehow 
>> this:
>>
>> auto tmp = set_a-set_b;
>>
>> produces different results as this:
>>
>> set_a = set_a-set_b;
>>
>> the latter will produce an empty set.
>>
>> I tried to reduce the source code to get a test case. But this 
>> problem just goes away after removing some code.
>>
>> Any ideas what I could have done wrong?
>
> A slightly more reduced test case:
>

And LDC has the same problem with the first test case, but not 
with the second one.




More information about the Digitalmars-d-learn mailing list