You can't do this because there isn't any code that knows both B and D at compile time.
The case I'm thinking of involves some templated container that has an object of type D. (Maybe it's a type erasure system, a smart pointer, whatever). That container knows the type D because it was passed as a template argument when it was instantiated with a brand new D object. Somewhere else, some other code has a pointer B* and they want it to point to this object, but they don't know what type D is (it might not even be knowable until runtime).