Variant implementation in C++
Some issues:


the assignment operator doesn't call the destructor of the existing data, before setting a new value (results in UB, likely a resource leak).
by default you do not instantiate an empty variant with the default constructor; the first type in the union may not even be default-constructible.
bad_variant_access should probably inherit from a standard exception (std::runtime_error or std::logic_error are common as base classes).