[Allocator] MSVC apparantly has broken SFINAE context handling of

'sizeof(T)' for T == void and produces a hard error. I cannot fathom why
this is OK. Oh well. switch to an explicit test for being the
(potentially qualified) void type, which is the only specific case I was
worried about. Hopefully this survives the libstdc++ build bots which
have limited type traits implementations...

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@206256 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chandler Carruth 2014-04-15 08:02:29 +00:00
parent d63390cba1
commit 2c9a974b2b

View File

@ -98,13 +98,16 @@ public:
/// \brief Deallocate space for one object without destroying it.
template <typename T>
typename std::enable_if<sizeof(T) != 0, void>::type Deallocate(T *Ptr) {
typename std::enable_if<
std::is_same<typename std::remove_cv<T>::type, void>::value, 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>
typename std::enable_if<sizeof(T) != 0, void>::type
typename std::enable_if<
std::is_same<typename std::remove_cv<T>::type, void>::value, void>::type
Deallocate(T *Ptr, size_t /*Num*/) {
Deallocate(static_cast<const void *>(Ptr));
}