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

[conv.ptr] p2 The cv-qualifications between source and destination type are not necessarily the same #5547

Closed
xmh0511 opened this issue Jul 4, 2022 · 1 comment

Comments

@xmh0511
Copy link
Contributor

xmh0511 commented Jul 4, 2022

[conv.ptr] p2 says

A prvalue of type “pointer to cv T”, where T is an object type, can be converted to a prvalue of type “pointer to cv void”.

The notation cv denotes the cv-qualification of the pointed-to type, which is used as the cv-qualification of the pointed-to type of the destination type. Consider this example:

int* ptr = 0;
void const* vptr = ptr;  // #1

#1 is ok but the source type is "pointer to int" while the destination type is "pointer to const void". In this case, the cv-qualification of the pointed-to types are different.

The change might be

A prvalue of type “pointer to cv1 T” can be converted to a prvalue of type “pointer to cv2 void”, where T is an object type and cv2 is the same cv-qualification as, or greater cv-qualification than, cv1.

@xmh0511
Copy link
Contributor Author

xmh0511 commented Jul 5, 2022

[conv.general] p1 says

int* -> void* -> void const*

a pointer conversion followed by a qualification conversion

@xmh0511 xmh0511 closed this as completed Jul 5, 2022
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

No branches or pull requests

1 participant