[llvm] r206256 - [Allocator] MSVC apparantly has broken SFINAE context handling of
Chandler Carruth
chandlerc at gmail.com
Tue Apr 15 01:02:29 PDT 2014
Author: chandlerc
Date: Tue Apr 15 03:02:29 2014
New Revision: 206256
URL: http://llvm.org/viewvc/llvm-project?rev=206256&view=rev
Log:
[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...
Modified:
llvm/trunk/include/llvm/Support/Allocator.h
Modified: llvm/trunk/include/llvm/Support/Allocator.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Allocator.h?rev=206256&r1=206255&r2=206256&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/Allocator.h (original)
+++ llvm/trunk/include/llvm/Support/Allocator.h Tue Apr 15 03:02:29 2014
@@ -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));
}
More information about the llvm-commits
mailing list