[ADT] Try again to use the same version of llvm::Optional on all compilers
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 20 Sep 2018 10:02:06 +0000 (10:02 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 20 Sep 2018 10:02:06 +0000 (10:02 +0000)
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.

llvm-svn: 342637

llvm/include/llvm/ADT/Optional.h

index 353e5d0..9242a0a 100644 (file)
@@ -108,7 +108,6 @@ template <typename T, bool IsPodLike> struct OptionalStorage {
   }
 };
 
-#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 OptionalStorage<T, true> {
 
   void reset() { hasVal = false; }
 };
-#endif
 } // namespace optional_detail
 
 template <typename T> class Optional {