Browse Source

[ADT] Replace a member initializer of a union with an explicit
constructor.

This breaking an old/weird host compiler is my best bet for the current
crashes I'm getting from bots since this functionality was added to this
ADT.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@339975 91177308-0d34-0410-b5e6-96231b3b80d8

Chandler Carruth 7 years ago
parent
commit
bc3032830f
1 changed files with 6 additions and 2 deletions
  1. 6 2
      include/llvm/ADT/PointerSumType.h

+ 6 - 2
include/llvm/ADT/PointerSumType.h

@@ -80,8 +80,12 @@ template <typename TagT, typename... MemberTs> class PointerSumType {
   // when we *read* a value, we copy the underlying storage out to avoid relying
   // on one member or the other being active.
   union StorageT {
-    // Ensure we get a null default constructed value.
-    uintptr_t Value = 0;
+    // Ensure we get a null default constructed value. We don't use a member
+    // initializer because some compilers seem to not implement those correctly
+    // for a union.
+    StorageT() : Value(0) {}
+
+    uintptr_t Value;
 
     typename HelperT::template Lookup<HelperT::MinTag>::PointerT MinTagPointer;
   };