SumType in Phobos?

Paul Backus snarwin at gmail.com
Thu Feb 20 18:23:45 UTC 2020


On Thursday, 20 February 2020 at 17:40:46 UTC, Per Nordlöw wrote:
> On Thursday, 20 February 2020 at 17:14:13 UTC, Paul Backus 
> wrote:
>> The amount of @trusted code is also a red flag. I've already 
>> found one mistake in it [1], which means there are probably at 
>> least a couple more that I didn't catch.
>>
>> [1] 
>> https://github.com/nordlow/phobos-next/blob/master/src/nxt/variant.d#L226-L228
>
> I see now that the private function `as` should be qualified as 
> @system.
>
> Is this the mistake you are thinking about?

In the `else` branch of the `static if` statement, if `T` has 
both a copy constructor and a destructor, the copy constructor is 
skipped but the destructor will still be called.


More information about the Digitalmars-d mailing list