From 7c3ef27b68410595c3a6a05bc793dac4983aacf4 Mon Sep 17 00:00:00 2001 From: maier Date: Thu, 1 Nov 2012 22:40:10 +0000 Subject: [PATCH] Add a lonely, forgotten bugtest git-svn-id: https://svn.dealii.org/branches/branch_cmake@27302 0785d39b-7218-0410-832d-ea1e28bc413d --- .../checks/check_for_compiler_bugs.cmake | 31 +++++++++++++++++++ deal.II/include/deal.II/base/config.h.in | 5 +++ 2 files changed, 36 insertions(+) diff --git a/deal.II/cmake/checks/check_for_compiler_bugs.cmake b/deal.II/cmake/checks/check_for_compiler_bugs.cmake index 9d7bd356b0..9214f680b9 100644 --- a/deal.II/cmake/checks/check_for_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_for_compiler_bugs.cmake @@ -202,6 +202,37 @@ CHECK_CXX_COMPILER_BUG( DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG ) +# +# Many compilers get this wrong (see Section 14.7.3.1, number (4)): +# +# template struct T { +# static const int i; +# }; +# +# template <> const int T<1>::i; +# template <> const int T<1>::i = 1; +# +# First, by Section 14.7.3.14 of the standard, the first template<> +# line must necessarily be the _declaration_ of a specialization, +# and the second is then its definition. There is therefore no +# reason to report a doubly defined variable (Intel ICC 6.0), or +# to choke on these lines at all (Sun Forte) +# +# - Wolfgang Bangerth, Matthias Maier, rewritten 2012 +# +CHECK_CXX_COMPILER_BUG( + " + template struct T + { + static const int i; + }; + template <> const int T<1>::i; + template <> const int T<1>::i = 1; + int main() {return 0;} + " + DEAL_II_MEMBER_VAR_SPECIALIZATION_BUG + ) + # # Some older versions of gcc compile this, despite the 'explicit' diff --git a/deal.II/include/deal.II/base/config.h.in b/deal.II/include/deal.II/base/config.h.in index 571646cc3a..0bf1afbfb5 100644 --- a/deal.II/include/deal.II/base/config.h.in +++ b/deal.II/include/deal.II/base/config.h.in @@ -415,6 +415,11 @@ */ #cmakedefine DEAL_II_MEMBER_ARRAY_SPECIALIZATION_BUG +/* Defined if the compiler refuses to allow the explicit specialization of + * static member variables. + */ +#cmakedefine DEAL_II_MEMBER_VAR_SPECIALIZATION_BUG + /* Defined if the compiler does not honor the explicit keyword on template * constructors. */ -- 2.39.5