File llvm-drop-llvm-optional-clang-specific-optimization.patch of Package llvm7.15611
Subject: [ADT] Drop llvm::Optional clang-specific optmization for trivially copyable…
References: boo#1119092 https://reviews.llvm.org/rL346985
Index: llvm/include/llvm/ADT/Optional.h
===================================================================
--- llvm/include/llvm/ADT/Optional.h (revision 346984)
+++ llvm/include/llvm/ADT/Optional.h (revision 346985)
@@ -108,24 +108,6 @@
}
};
-#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;
- bool hasVal = false;
-
- OptionalStorage() = default;
-
- OptionalStorage(const T &y) : hasVal(true) { new (storage.buffer) T(y); }
- OptionalStorage &operator=(const T &y) {
- *reinterpret_cast<T *>(storage.buffer) = y;
- hasVal = true;
- return *this;
- }
-
- void reset() { hasVal = false; }
-};
-#endif
} // namespace optional_detail
template <typename T> class Optional {