It it undefined behavior to cast an unrelated type to an empty base class? And then use that address to construct a derived type that inherits from that empty base? For example
class Derived : public EmptyBase {
public:
template <typename T>
Derived(T&& t) : EmptyBase{std::forward<T>(t)} {}
using EmptyBase::print;
};
and then is it undefined to do something like this
static auto shim = 1;
auto derived = Derived{*reinterpret_cast<EmptyBase*>(&shim)};
derived.print();
The standard guarantees that empty bases must be optimized away in a standard layout struct, but not sure about whether something like this is allowed to construct a derived class