Skip to content

[expr.dynamic.cast] CWG 2365: Incorrect wording regarding dynamic_cast #1453

@introom

Description

@introom

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cwgIssue must be reviewed by CWG.not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions