[PATCH] D124571: Avoid strict aliasing violation on type punning inside llvm::PointerIntPair
Argyrios Kyrtzidis via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 28 10:09:21 PDT 2022
akyrtzi added inline comments.
================
Comment at: llvm/include/llvm/ADT/PointerIntPair.h:28
+namespace detail {
+template <typename Ptr> struct PunnedPointer {
+ explicit constexpr PunnedPointer(intptr_t i = 0) { *this = i; }
----------------
I'd recommend to also add
```
static_assert(sizeof(Ptr) == sizeof(intptr_t), "");
```
for sanity checking.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D124571/new/
https://reviews.llvm.org/D124571
More information about the llvm-commits
mailing list