From: Wolfgang Bangerth Date: Mon, 6 May 2002 13:10:02 +0000 (+0000) Subject: DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG X-Git-Tag: v8.0.0~18040 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c965b29bc5b2e1b325b8abf2d95b468df2685d2d;p=dealii.git DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG git-svn-id: https://svn.dealii.org/trunk@5824 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index e7e27ebfb5..3b480676f0 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -1886,6 +1886,55 @@ AC_DEFUN(DEAL_II_CHECK_TEMPLATE_TEMPLATE_TYPEDEF_BUG, dnl +dnl ------------------------------------------------------------- +dnl Many compilers get this wrong (see Section 14.7.3.1, number (4)): +dnl --------------------------------- +dnl template struct T { +dnl static const int i; +dnl }; +dnl +dnl template <> const int T<1>::i; +dnl template <> const int T<1>::i = 1; +dnl --------------------------------- +dnl First, by Section 14.7.3.14 of the standard, the first template<> +dnl line must necessarily be the _declaration_ of a specialization, +dnl and the second is then its definition. There is therefore no +dnl reason to report a doubly defined variable (Intel ICC 6.0), or +dnl to choke on these lines at all (Sun Forte) +dnl +dnl Usage: DEAL_II_CHECK_MEMBER_VARIALIZATION_SPEC_BUG +dnl +dnl ------------------------------------------------------------- +AC_DEFUN(DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG, dnl +[ + AC_MSG_CHECKING(for member variable specialization bug) + AC_LANG(C++) + CXXFLAGS="$CXXFLAGSG" + AC_TRY_COMPILE( + [ + template struct T { + static const int i; + }; + + template <> const int T<1>::i; + template <> const int T<1>::i = 1; + ], + [], + [ + AC_MSG_RESULT(no) + ], + [ + AC_MSG_RESULT(yes. using workaround) + AC_DEFINE(DEAL_II_MEMBER_VAR_SPECIALIZATION_BUG, 1, + [Defined if the compiler refuses to allow the + explicit specialization of static member + variables. For the exact failure mode, look at + aclocal.m4 in the top-level directory.]) + ]) +]) + + + dnl ------------------------------------------------------------- dnl gcc2.95 doesn't have the std::iterator class, but the standard diff --git a/deal.II/configure.in b/deal.II/configure.in index 30ffe96468..a22cda94f2 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -159,6 +159,7 @@ DEAL_II_CHECK_TEMPL_CONST_MEM_PTR_BUG DEAL_II_CHECK_CONST_MEM_FUN_PTR_BUG DEAL_II_CHECK_IMPLEMENTED_PURE_FUNCTION_BUG DEAL_II_CHECK_TEMPLATE_TEMPLATE_TYPEDEF_BUG +DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG DEAL_II_HAVE_PRETTY_FUNCTION DEAL_II_HAVE_STD_ITERATOR DEAL_II_HAVE_STD_STRINGSTREAM