mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-15 04:30:12 +00:00
[Allocator] Constrain the Deallocate templated overloads to only apply
to types which we can compute the size of. The comparison with zero isn't actually interesting here, it's mostly about putting sizeof into a sfinae context. This is particular important for Deallocate as otherwise the void* overload can quickly become ambiguous. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206251 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
9eb71e20ae
commit
eb19b8f58b
@ -97,12 +97,15 @@ public:
|
||||
}
|
||||
|
||||
/// \brief Deallocate space for one object without destroying it.
|
||||
template <typename T> void Deallocate(T *Ptr) {
|
||||
template <typename T>
|
||||
typename std::enable_if<sizeof(T) != 0, void>::type Deallocate(T *Ptr) {
|
||||
Deallocate(static_cast<const void *>(Ptr));
|
||||
}
|
||||
|
||||
/// \brief Allocate space for an array of objects without constructing them.
|
||||
template <typename T> void Deallocate(T *Ptr, size_t /*Num*/) {
|
||||
template <typename T>
|
||||
typename std::enable_if<sizeof(T) != 0, void>::type
|
||||
Deallocate(T *Ptr, size_t /*Num*/) {
|
||||
Deallocate(static_cast<const void *>(Ptr));
|
||||
}
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user