Is std.variant.visit not @nogc?

Hasen Judy hasen.judy at gmail.com
Mon Apr 9 07:02:50 UTC 2018


On Monday, 9 April 2018 at 03:41:17 UTC, Adam D. Ruppe wrote:
> On Monday, 9 April 2018 at 03:20:58 UTC, helxi wrote:
>
> visit, being a template, is @nogc or not based on the arguments 
> passed to it as well as its own body, so while the error 
> messages point to visit itself, these are frequently actually 
> caused the predicate your pass.
>
> [....]
>
> std.variant.VariantException.this is not marked @nogc (but it 
> prolly could be)
>
> VariantN.peek is not @nogc because it calls Object.opEquals... 
> which is broken af, sadly, but can probably be fixed for this 
> case by marking TypeInfo.opEquals nogc.
>


IMO, this is one more reason why sum-types should be built into 
the language compiler, instead of being implemented in user-space.


More information about the Digitalmars-d-learn mailing list