Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
[expr.dynamic.cast] CWG 2365: Incorrect wording regarding dynamic_cast #1453
In paragraph 4, http://eel.is/c++draft/expr.dynamic.cast#4
If the value of v is a null pointer value in the pointer case, the result is the null pointer value of type T.
And in paragraph6,
Otherwise, v shall be a pointer to or a glvalue of a polymorphic type.
So the otherwise means the v in p4 doesn't have to be polymorphic.
However, this is not possible because the compiler can only check if "v" is a null pointer at runtime. If "v" is not a null pointer, and unluckily has no RTTI, then the runtime could do nothing meaningufl, ill-formed?
BTW, Clang and GCC requires the "v" in p4 to be of pointer to polymorphic type.