I have three classes:
class A {};
class B : virtual public A {};
class C : virtual public A {};
class D: public B, public C {};
Attemptin
$5.2.9/2- "An expression e can be explicitly converted to a type T using a static_cast of the form static_cast(e) if the declaration “T t(e);” is well-formed, for some invented temporary variable t (8.5)."
In your code you are attempting static_cast with 'T = B*' and 'e = A*'
Now 'B* t(A*)' is not well-formed in C++ (but 'A* t(B*)' is because 'A' is a virtual unambiguous and accessible base of 'B'. Therefore the code gives error.