[llvm] r320733 - Only use is_trivially_copyable if we know it's safe to do so.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 14 11:11:28 PST 2017


Author: zturner
Date: Thu Dec 14 11:11:28 2017
New Revision: 320733

URL: http://llvm.org/viewvc/llvm-project?rev=320733&view=rev
Log:
Only use is_trivially_copyable if we know it's safe to do so.

Apparently this isn't present on older versions of libstdc++, so
it causes some builds to fail.

Modified:
    llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h

Modified: llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h?rev=320733&r1=320732&r2=320733&view=diff
==============================================================================
--- llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h (original)
+++ llvm/trunk/include/llvm/DebugInfo/CodeView/TypeHashing.h Thu Dec 14 11:11:28 2017
@@ -132,11 +132,15 @@ struct GloballyHashedType {
     return Hashes;
   }
 };
+#if defined(_MSC_VER)
+// is_trivially_copyable is not available in older versions of libc++, but it is
+// available in all supported versions of MSVC, so at least this gives us some
+// coverage.
 static_assert(std::is_trivially_copyable<GloballyHashedType>::value,
               "GloballyHashedType must be trivially copyable so that we can "
               "reinterpret_cast arrays of hash data to arrays of "
               "GloballyHashedType");
-
+#endif
 } // namespace codeview
 
 template <> struct DenseMapInfo<codeview::LocallyHashedType> {




More information about the llvm-commits mailing list