56 lines
2.2 KiB
Diff
56 lines
2.2 KiB
Diff
|
diff -up chromium-65.0.3325.146/base/optional.h.784732 chromium-65.0.3325.146/base/optional.h
|
||
|
--- chromium-65.0.3325.146/base/optional.h.784732 2018-03-07 13:40:00.103579631 -0500
|
||
|
+++ chromium-65.0.3325.146/base/optional.h 2018-03-07 13:41:08.950323996 -0500
|
||
|
@@ -9,6 +9,7 @@
|
||
|
#include <utility>
|
||
|
|
||
|
#include "base/logging.h"
|
||
|
+#include "base/template_util.h"
|
||
|
|
||
|
namespace base {
|
||
|
|
||
|
@@ -106,7 +107,7 @@ struct OptionalStorageBase<T, true /* tr
|
||
|
// compiler generated constexpr {copy,move} constructors). Note that
|
||
|
// placement-new is prohibited in constexpr.
|
||
|
template <typename T,
|
||
|
- bool = std::is_trivially_copy_constructible<T>::value,
|
||
|
+ bool = is_trivially_copy_constructible<T>::value,
|
||
|
bool = std::is_trivially_move_constructible<T>::value>
|
||
|
struct OptionalStorage : OptionalStorageBase<T> {
|
||
|
// This is no trivially {copy,move} constructible case. Other cases are
|
||
|
diff -up chromium-65.0.3325.146/base/template_util.h.784732 chromium-65.0.3325.146/base/template_util.h
|
||
|
--- chromium-65.0.3325.146/base/template_util.h.784732 2018-03-07 13:41:19.479131969 -0500
|
||
|
+++ chromium-65.0.3325.146/base/template_util.h 2018-03-07 13:42:41.308639551 -0500
|
||
|
@@ -10,6 +10,7 @@
|
||
|
#include <iterator>
|
||
|
#include <type_traits>
|
||
|
#include <utility>
|
||
|
+#include <vector>
|
||
|
|
||
|
#include "build/build_config.h"
|
||
|
|
||
|
@@ -127,6 +128,23 @@ template <class T>
|
||
|
using is_trivially_copyable = std::is_trivially_copyable<T>;
|
||
|
#endif
|
||
|
|
||
|
+#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ <= 7
|
||
|
+// Workaround for g++7 and earlier family.
|
||
|
+// Due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80654, without this
|
||
|
+// Optional<std::vector<T>> where T is non-copyable causes a compile error.
|
||
|
+// As we know it is not trivially copy constructible, explicitly declare so.
|
||
|
+template <typename T>
|
||
|
+struct is_trivially_copy_constructible
|
||
|
+ : std::is_trivially_copy_constructible<T> {};
|
||
|
+
|
||
|
+template <typename... T>
|
||
|
+struct is_trivially_copy_constructible<std::vector<T...>> : std::false_type {};
|
||
|
+#else
|
||
|
+// Otherwise use std::is_trivially_copy_constructible as is.
|
||
|
+template <typename T>
|
||
|
+using is_trivially_copy_constructible = std::is_trivially_copy_constructible<T>;
|
||
|
+#endif
|
||
|
+
|
||
|
} // namespace base
|
||
|
|
||
|
#undef CR_USE_FALLBACKS_FOR_GCC_WITH_LIBCXX
|