]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Add a configuration check for DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
authorMatthias Maier <tamiko@43-1.org>
Tue, 29 Jun 2021 16:13:13 +0000 (11:13 -0500)
committerMatthias Maier <tamiko@43-1.org>
Tue, 29 Jun 2021 16:17:30 +0000 (11:17 -0500)
cmake/checks/check_03_compiler_bugs.cmake
include/deal.II/base/config.h.in

index f80a8c5350af7aea025d04e1eb903b4c29b0ae47..989bb784fdab9517fe2fa8ecac66d1bfea2008c2 100644 (file)
@@ -41,3 +41,29 @@ ENDIF()
 IF(CMAKE_CXX_COMPILER_ID MATCHES "Intel" AND CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL "16.0.1" )
   MESSAGE(FATAL_ERROR "Intel compiler version 16.0.1 is not supported, please update to 16.0.2 or newer!")
 ENDIF()
+
+
+#
+# Check for a regression in gcc-11.1.0 where a deleted move constructor
+# prevents templated constructor from being used. For details see
+#
+#   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100644
+#   https://github.com/dealii/dealii/issues/12244
+#   https://github.com/dealii/dealii/pull/12246
+#
+# - Mathias Anselmann, Matthias Maier, David Wells, 2021
+#
+CHECK_CXX_COMPILER_BUG(
+  "
+  struct NonMovable {
+    NonMovable() = default;
+    NonMovable(NonMovable &&) = delete;
+  };
+  template <class T> struct Maybe {
+    NonMovable mMember;
+    template <typename U> Maybe(Maybe<U> &&) : mMember() {}
+  };
+  void unlucky(Maybe<int> &&x) { Maybe<int> var{(Maybe<int> &&) x}; }
+  int main() { return 0; }
+  "
+  DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG)
index c6dc2baf6d884c104c2ccfeda707c9596a8222a3..0a75c7c330c8cb98762e8f24b4afb1b34e546dee 100644 (file)
@@ -81,6 +81,8 @@
  * For documentation see cmake/checks/check_03_compiler_bugs.cmake
  */
 
+#cmakedefine DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG
+
 /***********************************************************************
  * Compiler features:
  *

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.