[llvm] r342723 - [ADT] Hack around GCC 5.4 miscompiling Optional of enum.
Benjamin Kramer via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 21 04:38:35 PDT 2018
Author: d0k
Date: Fri Sep 21 04:38:35 2018
New Revision: 342723
URL: http://llvm.org/viewvc/llvm-project?rev=342723&view=rev
Log:
[ADT] Hack around GCC 5.4 miscompiling Optional of enum.
I'm still not 100% sure that this is not UB lingering (Optional has UB
and should use std::launder, but we don't have std::launder)
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=342723&r1=342722&r2=342723&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Optional.h (original)
+++ llvm/trunk/include/llvm/ADT/Optional.h Fri Sep 21 04:38:35 2018
@@ -130,7 +130,10 @@ template <typename T> struct OptionalSto
} // namespace optional_detail
template <typename T> class Optional {
- optional_detail::OptionalStorage<T, isPodLike<T>::value> Storage;
+ // GCC 5.4 miscompiles the trivially copyable OptionalStorage. Blacklist it.
+ optional_detail::OptionalStorage<T, isPodLike<T>::value &&
+ !std::is_enum<T>::value>
+ Storage;
public:
using value_type = T;
More information about the llvm-commits
mailing list