]> https://gitweb.dealii.org/ - dealii.git/commitdiff
DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 6 May 2002 13:10:02 +0000 (13:10 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 6 May 2002 13:10:02 +0000 (13:10 +0000)
git-svn-id: https://svn.dealii.org/trunk@5824 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure.in

index e7e27ebfb5635fe377fc21ad5988c38cf4729d60..3b480676f05ab08a0cba52f1d519d80361b52905 100644 (file)
@@ -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 <int dim> 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 <int dim> 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
index 30ffe964685730d8e5bf134c0398af92cf269734..a22cda94f2e64bb905a177bee9f55c8f20cf4689 100644 (file)
@@ -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

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.