From: Matthias Maier Date: Sat, 23 May 2020 04:54:30 +0000 (-0500) Subject: CMake: remove obsolete compiler bug tests X-Git-Tag: v9.3.0-rc1~1579^2~2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2199dfde67fc8fbc08875788464e7a0bc1f4e6c0;p=dealii.git CMake: remove obsolete compiler bug tests The bugs DEAL_II_TEMPL_SPEC_FRIEND_BUG DEAL_II_CONST_MEMBER_DEDUCTION_BUG DEAL_II_BIND_NO_CONST_OP_PARENTHESES do not trigger for any compiler we currently use (including gcc-4.9 up to gcc-10, clang-4 up to clang-10 and corresponding apple clang, MSVC 2017 and 2019, icc 19*) The bug DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG triggers only on MSVC 2017 and 2019 but the preprocessor macro is not used in the library any more --- diff --git a/cmake/checks/check_03_compiler_bugs.cmake b/cmake/checks/check_03_compiler_bugs.cmake index f5b5ae7b53..5eb17500e8 100644 --- a/cmake/checks/check_03_compiler_bugs.cmake +++ b/cmake/checks/check_03_compiler_bugs.cmake @@ -19,139 +19,6 @@ # # ######################################################################## -# -# In some cases, we would like to name partial specializations -# as friends. However, the standard forbids us to do so. But -# then, we can declare the general template as a friend, and -# at least gcc extends the friendship to all specializations -# of the templates, which is not what the standard says. -# -# With other compilers, most notably cxx, this does not work. -# In this case, we can make individual specializations friends, -# which in turn gcc rejects. So check, whether this is possible. -# -# The respective clause in the standard is 14.5.3.1, which gives -# this example: -# template class task { -# friend class task; -# }; -# -# - Wolfgang Bangerth, Matthias Maier, rewritten 2012 -# -CHECK_CXX_COMPILER_BUG( - " - template class X; - template class X<1,T>; - - template class Y { - static int i; - template friend class X; - friend class X<1,P>; - }; - - template class X<1,T> { - int f () { return Y::i; }; // access private field - }; - int main() { return 0; } - " - DEAL_II_TEMPL_SPEC_FRIEND_BUG) - - -# -# This is a variant of the previous test. Some icc 11.0 -# builds (sub-releases) on Windows apparently don't allow -# the declaration of an explicit specialization of member -# arrays of templates: -# -# template -# struct X -# { -# static const int N = 2*dim; -# static const int x[N]; -# }; -# template <> const int X<2>::x[N]; -# -# That version of icc requests that there be an initialization, -# i.e. it thinks that this is the *definition*, not merely a -# *declaration* of an explicit specialization. This is wrong, -# however. -# -# - Wolfgang Bangerth, Matthias Maier, rewritten 2012 -# -CHECK_CXX_COMPILER_BUG( - " - template - struct X - { - static const int N = 2*dim; - static const int x[N]; - }; - template <> const int X<2>::x[N]; - int main() { return 0; } - " - DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG - ) - - -# -# Some older versions of gcc deduce pointers to const functions in -# template contexts to pointer-to-function of const objects. -# This is not correct -# -# Check for this misfeature. -# -# - Wolfgang Bangerth, Matthias Maier, rewritten 2012 -# -CHECK_CXX_COMPILER_BUG( - " - template struct identity { typedef T type; }; - template void new_thread (void (C::*fun_ptr)(), - typename identity::type &c) {} - template void new_thread (void (C::*fun_ptr)() const, - const typename identity::type &c) {} - struct X { void f() const{} }; - - int main() - { - X x; - new_thread (&X::f, x); - } - " - DEAL_II_CONST_MEMBER_DEDUCTION_BUG - ) - - - -# -# Microsoft Visual C++ has a bug where the resulting object -# from calling std::bind does not have a const operator(), -# so we cannot pass such objects as const references as we -# usually do with input arguments of other functions. -# -# - Wolfgang Bangerth, 2014 -# -ADD_FLAGS(CMAKE_REQUIRED_FLAGS "${DEAL_II_CXX_FLAGS}") -CHECK_CXX_COMPILER_BUG( - " - #include - - void f(int, int) {} - - template - void g(const F &func) - { - func(1); - } - - int main () - { - g (std::bind(&f, std::placeholders::_1, 1)); - } - " - DEAL_II_BIND_NO_CONST_OP_PARENTHESES - ) -RESET_CMAKE_REQUIRED() - # # In intel (at least 13.1 and 14), vectorization causes