[2026-06 LWG Motion 17] P3125R6 constexpr pointer tagging#9120
Conversation
|
Need some help resolving the FIXMEs. |
| \pnum | ||
| \tcode{tagged_pointer_type} denotes \cv{}~\tcode{void*}, | ||
| %FIXME: what do we mean by "pointer denotes"? \tcode{pointer()}? | ||
| for \cv{} such that pointer denotes \cv{}~\tcode{U*} for some type \tcode{U}. |
There was a problem hiding this comment.
IIUC the "pointer" should be pointer_type.
I wonder whether \result is suitable here. Also, IIUC, we can just use using tagged_pointer_type = common_type_t<void*, pointer_type>;.
There was a problem hiding this comment.
@jwakely how do we fix this? Editorially or LWG issue, and in this PR or elsewhere?
There was a problem hiding this comment.
I don't think the intended meaning is clear. R4 and R5 had:
using tagged_pointer_type = conditional_t<is_const_v<pointer>, const void *, void *>;
But pointer isn't even defined, and presumably what it was meant to mean was is_const_v<remove_pointer_t<Ptr>>.
I think this needs an LWG issue unless @hanickadot can clarify.
There was a problem hiding this comment.
It's supposed to be COPYCV equivalent of this https://eel.is/c++draft/meta.trans.other#3.3
so tagged_pointer_type has same CV-qualifiers as pointer_type
There was a problem hiding this comment.
pointer_tag_pair<const T *, N>::tagged_pointer_type should be const void *
pointer_tag_pair<volatile T *, N>::tagged_pointer_type should be volatile void *
pointer_tag_pair<T *, N>::tagged_pointer_type should be void *
There was a problem hiding this comment.
I didn't know I can use std::common_type_t as @frederick-vs-ja proposed.
Originally it was supposed to be an unspecified type, maybe uintptr_t, (CV) void * ... as I went thru many back and forth with Jens in lib-ext@ mailing list to find something which works, he was concerned LEWG wasn't fully aware about the effects of the functionality returning basically always an invalid pointer value. Which until recently had implementation defined behavior for lvalue-to-rvalue conversion (not anymore).
There was a problem hiding this comment.
OK, let's follow it up later then. Thanks!
There was a problem hiding this comment.
Sorry, I wrote replies, there, but didn't notice I need to submit them in "Files Changes" tab 🤔
There was a problem hiding this comment.
I leave it to you and LWG to decide if this is editorial - if so, please send a PR and I can include it in the new draft!
cd64b11 to
0f665e9
Compare
Editorial notes:
* Used standard synposis comments with xrefs to subclauses.
* [ptrtag.pair.general] In the synopsis, move "tagged_pointer" up
to the "tagged pointer operations", corresponding to the subclause
in which the specification appears.
* Minor punctuation fixes.
0f665e9 to
907710e
Compare
Fixes #9104
Also fixes cplusplus/papers#1903