[llvm] r339975 - [ADT] Replace a member initializer of a union with an explicit

Chandler Carruth via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 16 18:10:34 PDT 2018


Author: chandlerc
Date: Thu Aug 16 18:10:33 2018
New Revision: 339975

URL: http://llvm.org/viewvc/llvm-project?rev=339975&view=rev
Log:
[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.

Modified:
    llvm/trunk/include/llvm/ADT/PointerSumType.h

Modified: llvm/trunk/include/llvm/ADT/PointerSumType.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/PointerSumType.h?rev=339975&r1=339974&r2=339975&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/PointerSumType.h (original)
+++ llvm/trunk/include/llvm/ADT/PointerSumType.h Thu Aug 16 18:10:33 2018
@@ -80,8 +80,12 @@ template <typename TagT, typename... Mem
   // 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;
   };




More information about the llvm-commits mailing list