[clang] [libcxx] [clang & libcxx] constexpr pointer tagging (DO NOT MERGE) (PR #111861)

Hana Dusíková via cfe-commits cfe-commits at lists.llvm.org
Thu Oct 10 08:48:13 PDT 2024


hanickadot wrote:

example of simple usage:
```c++
int64_t a = 42;
 
 uintptr_t tag = 0b101u;
 auto tptr = std::tagged_ptr(&a, tag);
 
 assert(tptr.unsafe_dirty_pointer() != &a);
 
 int64_t * original = tptr.pointer();
 assert(tag == tptr.tag());
 assert(original == &a);
 
 auto [p, t] = tptr;
 assert(p == &a);
 assert(t == tag);
 ```

https://github.com/llvm/llvm-project/pull/111861


More information about the cfe-commits mailing list