Skip to content

Commit

Permalink
[ADT] Be less clever when using a nonce type for disambiguation.
Browse files Browse the repository at this point in the history
Old compilers don't like constexpr, but we're only going to use this in one
place anyway: this file. Everyone else should go through PointerLikeTypeTraits.

Update to r261259.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@261268 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
jrose-apple committed Feb 18, 2016
1 parent a755f1b commit e172bc7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions include/llvm/ADT/PointerEmbeddedInt.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ class PointerEmbeddedInt {
Mask = static_cast<uintptr_t>(-1) << Bits
};

static constexpr const struct RawValueTag {} RawValue = RawValueTag();
struct RawValueTag {
explicit RawValueTag() = default;
};

friend class PointerLikeTypeTraits<PointerEmbeddedInt>;

Expand Down Expand Up @@ -86,10 +88,10 @@ class PointerLikeTypeTraits<PointerEmbeddedInt<IntT, Bits>> {
return reinterpret_cast<void *>(P.Value);
}
static inline T getFromVoidPointer(void *P) {
return T(reinterpret_cast<uintptr_t>(P), T::RawValue);
return T(reinterpret_cast<uintptr_t>(P), typename T::RawValueTag());
}
static inline T getFromVoidPointer(const void *P) {
return T(reinterpret_cast<uintptr_t>(P), T::RawValue);
return T(reinterpret_cast<uintptr_t>(P), typename T::RawValueTag());
}

enum { NumLowBitsAvailable = T::Shift };
Expand Down

0 comments on commit e172bc7

Please sign in to comment.