]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Detect and work around a bug involving typedefing with template template arguments...
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 6 May 2002 07:33:49 +0000 (07:33 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 6 May 2002 07:33:49 +0000 (07:33 +0000)
git-svn-id: https://svn.dealii.org/trunk@5805 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure.in
deal.II/deal.II/include/grid/intergrid_map.h

index d67f98269d1ef830f4359d6a83a1e474f271bab3..01679112e8d290dd2ff27debe6b440b3611c9174 100644 (file)
@@ -1771,6 +1771,62 @@ AC_DEFUN(DEAL_II_CHECK_IMPLEMENTED_PURE_FUNCTION_BUG, dnl
 
 
 
+dnl -------------------------------------------------------------
+dnl gcc 2.95 dies on this construct:
+dnl -----------------------------
+dnl template <int dim> struct TT { typedef int type; };
+dnl
+dnl template <template <int> class T> struct X {
+dnl     typedef typename T<1>::type type;
+dnl     void foo (type t);
+dnl };
+dnl
+dnl template <template <int> class T>
+dnl void X<T>::foo (type t) {};
+dnl
+dnl template struct X<TT>;
+dnl -----------------------------
+dnl
+dnl We work around this problem, if we encounter it.
+dnl
+dnl Usage: DEAL_II_CHECK_TEMPLATE_TEMPLATE_TYPEDEF_BUG
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_TEMPLATE_TEMPLATE_TYPEDEF_BUG, dnl
+[
+  AC_MSG_CHECKING(for template template typedef bug)
+  AC_LANG(C++)
+  CXXFLAGS="$CXXFLAGSG"
+  AC_TRY_COMPILE(
+    [
+       template <int dim> struct TT { typedef int type; };
+
+       template <template <int> class T> struct X {
+           typedef typename T<1>::type type;
+           void foo (type t);
+       };
+
+       template <template <int> class T>
+       void X<T>::foo (type t) {};
+
+       template struct X<TT>;
+    ],
+    [],
+    [
+      AC_MSG_RESULT(no)
+    ],
+    [
+      AC_MSG_RESULT(yes. using workaround)
+      AC_DEFINE(DEAL_II_TEMPLATE_TEMPLATE_TYPEDEF_BUG, 1, 
+                     [Defined if the compiler refuses to allow a typedef
+                      to a template template class template parameter. 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 7ccc7ac39d16578f0b61bfc618607a21928d950b..02ccdf5ed6416e1e61fb39c09410385f6c3571d2 100644 (file)
@@ -158,6 +158,7 @@ DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG
 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_HAVE_STD_ITERATOR
 DEAL_II_HAVE_STD_STRINGSTREAM
 DEAL_II_HAVE_STD_NUMERIC_LIMITS
index 4dd9aad34812a70da5a53149d3765a6e500aefcc..ad09cd3cc6eede59488e8b862e7db3e951de9718 100644 (file)
@@ -114,9 +114,10 @@ class InterGridMap
 {
   public:
 
-#if (__GNUC__==2) && (__GNUC_MINOR__==95)
+#ifdef DEAL_II_TEMPLATE_TEMPLATE_TYPEDEF
                                     // helper class
-    struct GridClass_dim : public GridClass<dim> {
+    struct GridClass_dim : public GridClass<dim>
+    {
                                         // constructor. will
                                         // not be implemented,
                                         // but suppresses compiler

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.