From c13accd3af1e4be7b2129ecae178c9e42200b12b Mon Sep 17 00:00:00 2001
From: Daniel Arndt <daniel.arndt@iwr.uni-heidelberg.de>
Date: Tue, 3 Jul 2018 23:36:35 +0200
Subject: [PATCH] Disable -Wclass-memaccess for non-CXX17 builds and in bundled
 boost

---
 .../boost/container/detail/copy_move_algo.hpp        | 12 +++++++++++-
 cmake/setup_compiler_flags_gnu.cmake                 |  8 ++++++++
 2 files changed, 19 insertions(+), 1 deletion(-)

diff --git a/bundled/boost-1.62.0/include/boost/container/detail/copy_move_algo.hpp b/bundled/boost-1.62.0/include/boost/container/detail/copy_move_algo.hpp
index ead93c6035..93573211a9 100644
--- a/bundled/boost-1.62.0/include/boost/container/detail/copy_move_algo.hpp
+++ b/bundled/boost-1.62.0/include/boost/container/detail/copy_move_algo.hpp
@@ -34,7 +34,12 @@
 // other
 #include <boost/core/no_exceptions_support.hpp>
 // std
-#include <cstring> //for emmove/memcpy
+#include <cstring> //for memmove/memcpy
+
+#if defined(BOOST_GCC) && (BOOST_GCC >= 80000)
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wclass-memaccess"
+#endif
 
 namespace boost {
 namespace container {
@@ -1141,4 +1146,9 @@ void move_assign_range_alloc_n( Allocator &a, I inp_start, typename allocator_tr
 }  //namespace container {
 }  //namespace boost {
 
+#if defined(BOOST_GCC) && (BOOST_GCC >= 80000)
+#pragma GCC diagnostic pop
+#endif
+
+
 #endif   //#ifndef BOOST_CONTAINER_DETAIL_COPY_MOVE_ALGO_HPP
diff --git a/cmake/setup_compiler_flags_gnu.cmake b/cmake/setup_compiler_flags_gnu.cmake
index ba005571e3..ae5496f683 100644
--- a/cmake/setup_compiler_flags_gnu.cmake
+++ b/cmake/setup_compiler_flags_gnu.cmake
@@ -86,6 +86,14 @@ ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-literal-suffix")
 #
 ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-psabi")
 
+#
+# Disable warnings regarding improper direct memory access
+# if compiling without C++17 support
+#
+IF(NOT DEAL_II_WITH_CXX17)
+  ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-class-memaccess")
+ENDIF()
+
 IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
   #
   # Silence Clang warnings about unused compiler parameters (works around a
-- 
2.39.5