]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
One more check for compiler bugs.
authorwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 Mar 2004 16:34:47 +0000 (16:34 +0000)
committerwolf <wolf@0785d39b-7218-0410-832d-ea1e28bc413d>
Mon, 8 Mar 2004 16:34:47 +0000 (16:34 +0000)
git-svn-id: https://svn.dealii.org/trunk@8677 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/base/include/base/config.h.in
deal.II/configure
deal.II/configure.in

index 0bc788bba35f55de030f1df98dd30749dc8fda25..00fc128e4db69132749b26ba117948efa9537a1e 100644 (file)
@@ -2484,6 +2484,49 @@ AC_DEFUN(DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG, dnl
 
 
 
+dnl -------------------------------------------------------------
+dnl gcc 2.95 doesn't like it if we have a member template function
+dnl and define it as a template while specializing the outer class
+dnl template. This is a nasty bug that is hard to work around...
+dnl
+dnl Usage: DEAL_II_CHECK_MEMBER_TEMPLATE_SPECIALIZATION_BUG
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_MEMBER_TEMPLATE_SPECIALIZATION_BUG, dnl
+[
+  AC_MSG_CHECKING(for template member function specialization bug)
+  AC_LANG(C++)
+  CXXFLAGS="$CXXFLAGSG"
+  AC_TRY_COMPILE(
+    [
+      template <int dim> struct X 
+      {
+        template <typename T> void f(T);
+      };
+
+      template <>
+      template <typename T>
+      void X<1>::f (T)
+      {}
+
+      template void X<1>::f(int);
+    ],
+    [],
+    [
+      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 specialize
+                      an outer class template while keeping a member
+                      as a template. For the exact failure mode, look at
+                      aclocal.m4 in the top-level directory.])
+    ])
+])
+
+
+
 dnl -------------------------------------------------------------
 dnl gcc3.1 (and maybe later compilers) has a bug with long double
 dnl and optimization (see code below), when compiling on Sparc
index a06e7f34e28d5cc93ca67087112202afffb4a7e6..8660e1db9ee01fedd298adbf198be443e48a4f5c 100644 (file)
@@ -85,9 +85,9 @@
    directory for a description of this bug. */
 #undef DEAL_II_MEMBER_OP_TEMPLATE_INST
 
-/* 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. */
+/* Defined if the compiler refuses to specialize an outer class template while
+   keeping a member as a template. For the exact failure mode, look at
+   aclocal.m4 in the top-level directory. */
 #undef DEAL_II_MEMBER_VAR_SPECIALIZATION_BUG
 
 /* Minor version number of deal.II */
index d4bcb278cf2310d516fa7171146c69aec5de9bad..59b601f8757284efd175ede4ae32570319d0b253 100755 (executable)
@@ -4966,6 +4966,76 @@ cat >>confdefs.h <<\_ACEOF
 _ACEOF
 
 
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+  echo "$as_me:$LINENO: checking for template member function specialization bug" >&5
+echo $ECHO_N "checking for template member function specialization bug... $ECHO_C" >&6
+  ac_ext=cc
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+  CXXFLAGS="$CXXFLAGSG"
+  cat >conftest.$ac_ext <<_ACEOF
+#line $LINENO "configure"
+/* confdefs.h.  */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h.  */
+
+      template <int dim> struct X
+      {
+        template <typename T> void f(T);
+      };
+
+      template <>
+      template <typename T>
+      void X<1>::f (T)
+      {}
+
+      template void X<1>::f(int);
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+  (eval $ac_compile) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); } &&
+         { ac_try='test -s conftest.$ac_objext'
+  { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
+  (eval $ac_try) 2>&5
+  ac_status=$?
+  echo "$as_me:$LINENO: \$? = $ac_status" >&5
+  (exit $ac_status); }; }; then
+
+      echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6
+
+else
+  echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+      echo "$as_me:$LINENO: result: yes. using workaround" >&5
+echo "${ECHO_T}yes. using workaround" >&6
+
+cat >>confdefs.h <<\_ACEOF
+#define DEAL_II_MEMBER_VAR_SPECIALIZATION_BUG 1
+_ACEOF
+
+
 fi
 rm -f conftest.$ac_objext conftest.$ac_ext
 
index 8cdcc1f6a64db907f0181ae2ea3793e1e09534a4..3ae1b2bb3b9a0881fde494b7f50849d1150f45c9 100644 (file)
@@ -9,7 +9,7 @@ dnl    is stored.
 dnl
 dnl
 dnl authors: Wolfgang Bangerth, Guido Kanschat, and others 
-dnl          1999, 2000, 2001, 2002
+dnl          1999, 2000, 2001, 2002, 2003, 2004
 dnl
 
 
@@ -176,6 +176,7 @@ DEAL_II_CHECK_FUNPTR_TEMPLATE_TEMPLATE_BUG
 DEAL_II_CHECK_NESTED_CLASS_FRIEND_BUG
 DEAL_II_CHECK_NESTED_CLASS_TEMPL_FRIEND_BUG
 DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG
+DEAL_II_CHECK_MEMBER_TEMPLATE_SPECIALIZATION_BUG
 DEAL_II_CHECK_LONG_DOUBLE_LOOP_BUG
 DEAL_II_CHECK_ANON_NAMESPACE_BUG
 DEAL_II_CHECK_ANON_NAMESPACE_BUG2

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.