Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xmh0511 opened this issue Aug 21, 2022 · 0 comments · May be fixed by #6203
Open

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

xmh0511 opened this issue Aug 21, 2022 · 0 comments · May be fixed by #6203

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Aug 21, 2022

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”.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant