I was checking the behavior of dynamic_cast and found that when it fails, std::bad_cast exception is thrown only if the destination is a reference type. If the destination i
See the C++ Standard, section 5.2.7/9:
9 The value of a failed cast to pointer type is the null pointer value of the required result type. A failed cast to reference type throws bad_cast (18.5.2).
As to why - these are Stroustrup's words from the D & E book, section 14.2.2:
I use a reference cast when I want an assumption about a reference type checked and consider it a failure for my assumption to be wrong. If instead I want to select among plausible alternatives, I use a pointer cast and test the result.