From: Matthias Maier Date: Tue, 29 Jun 2021 16:13:13 +0000 (-0500) Subject: CMake: Add a configuration check for DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG X-Git-Tag: v9.4.0-rc1~1184^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=394044b694d7b5a9e8cd818f307255dd0b82b41b;p=dealii.git CMake: Add a configuration check for DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG --- diff --git a/cmake/checks/check_03_compiler_bugs.cmake b/cmake/checks/check_03_compiler_bugs.cmake index f80a8c5350..989bb784fd 100644 --- a/cmake/checks/check_03_compiler_bugs.cmake +++ b/cmake/checks/check_03_compiler_bugs.cmake @@ -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 struct Maybe { + NonMovable mMember; + template Maybe(Maybe &&) : mMember() {} + }; + void unlucky(Maybe &&x) { Maybe var{(Maybe &&) x}; } + int main() { return 0; } + " + DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG) diff --git a/include/deal.II/base/config.h.in b/include/deal.II/base/config.h.in index c6dc2baf6d..0a75c7c330 100644 --- a/include/deal.II/base/config.h.in +++ b/include/deal.II/base/config.h.in @@ -81,6 +81,8 @@ * For documentation see cmake/checks/check_03_compiler_bugs.cmake */ +#cmakedefine DEAL_II_DELETED_MOVE_CONSTRUCTOR_BUG + /*********************************************************************** * Compiler features: *