The type is not unknown. It's just variant or dynamic.
The destructor is still run. This is the entire point of using these classes: they provide value semantics[1] on variable typed data.
Or reference-wrapper semantics, if you will, for boost::variant<T&>