How to workaround on this (bug?)

frame frame86 at live.com
Sat Sep 17 00:19:16 UTC 2022


On Friday, 16 September 2022 at 23:06:35 UTC, H. S. Teoh wrote:

> Basically, if you pass something to .fun by value, then that 
> value must be destroyed by .fun once it's ready to return.  So 
> if the value has a dtor, the dtor must be called upon exiting 
> from .fun.  Since Variant has a throwing dtor, this means .fun 
> may throw when it's about to return, which violates `nothrow`.

I understand why this happens but not why the compiler does not 
check if the value is actually destroyed in user code by 
`.destroy()`.

Thanks for your suggestion, I will consider this.


More information about the Digitalmars-d-learn mailing list