Closed derekdai closed 1 year ago
This is expected - newruntime (arc and orc) do support changing active branch at runtime as long as you don't have a custom destructor attached to your object variant
I think this should continue to be disallowed, the workaround is o = O(kind: a, ...)
(reassign the complete structure).
I think this should continue to be disallowed
I agree. It should be covered by {.cast(uncheckedAssign).}
instead.
In section Object variants of manual, the example says
But in fact compiler accept it, and
=destroy
is called to prevent resources leak.Example
Current Output
=destroy
will be called event with refc.Expected Output
Compile with error.
Possible Solution
Additional Information
If I change
d: X
tod: ref X
, with arc or orc, outputWith refc
Tested with 1.4.8 and devel