[llvm] r342637 - [ADT] Try again to use the same version of llvm::Optional on all compilers

Benjamin Kramer via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 20 03:02:06 PDT 2018


Author: d0k
Date: Thu Sep 20 03:02:06 2018
New Revision: 342637

URL: http://llvm.org/viewvc/llvm-project?rev=342637&view=rev
Log:
[ADT] Try again to use the same version of llvm::Optional on all compilers

The miscompile doesn't reproduce for me anymore with GCC 7.3. I'll watch
the buildbots closely.

Having different versions of Optional is an ABI violation when linking
GCC- and clang-built code together.

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

Modified: llvm/trunk/include/llvm/ADT/Optional.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Optional.h?rev=342637&r1=342636&r2=342637&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Optional.h (original)
+++ llvm/trunk/include/llvm/ADT/Optional.h Thu Sep 20 03:02:06 2018
@@ -108,7 +108,6 @@ template <typename T, bool IsPodLike> st
   }
 };
 
-#if !defined(__GNUC__) || defined(__clang__) // GCC up to GCC7 miscompiles this.
 /// Storage for trivially copyable types only.
 template <typename T> struct OptionalStorage<T, true> {
   AlignedCharArrayUnion<T> storage;
@@ -125,7 +124,6 @@ template <typename T> struct OptionalSto
 
   void reset() { hasVal = false; }
 };
-#endif
 } // namespace optional_detail
 
 template <typename T> class Optional {




More information about the llvm-commits mailing list