Skip to content

[defns.dynamic.type] A misleading note #5762

Closed
@xmh0511

Description

@xmh0511

If a pointer p whose static type is “pointer to class B” is pointing to an object of class D, derived from B, the dynamic type of the expression *p is “D”.

In normal, according to the pointer conversion, a static type of “pointer to class B” is pointing to the base class subobject B rather than the complete object D. The implication of the note would result in the misreading to [expr.unary.op] p1

the result is an lvalue referring to the object or function to which the expression points.

The note may be clear if we say

If a pointer p whose static type is “pointer to class B” is pointing to the base class B subobject of class D, derived from B, the dynamic type of the expression *p is “D”.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions