]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
DEAL_II_CHECK_NESTED_NESTED_FRIEND_BUG
authordeal <deal@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 Mar 2003 15:37:50 +0000 (15:37 +0000)
committerdeal <deal@0785d39b-7218-0410-832d-ea1e28bc413d>
Tue, 11 Mar 2003 15:37:50 +0000 (15:37 +0000)
git-svn-id: https://svn.dealii.org/trunk@7315 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure.in
deal.II/lac/include/lac/sparse_matrix_ez.h

index 4ce04fc9252f8de6303a2b8dbb01f6bdcd15d7dc..feed3bc8bc4b7478da4affb174bf7c489aa3eb7f 100644 (file)
@@ -2341,6 +2341,53 @@ AC_DEFUN(DEAL_II_CHECK_NESTED_CLASS_FRIEND_BUG, dnl
 
 
 
+dnl -------------------------------------------------------------
+dnl Icc7 gets this wrong:
+dnl ----------------------
+dnl class O {
+dnl   class I {
+dnl    class II {};
+dnl     };
+dnl   friend class I::II;
+dnl };
+dnl ----------------------
+dnl It complains in the friend declaration that I::II is not accessible.
+dnl This is bogus, since we don't need to have access to a class that we
+dnl want to grant friendship (friendship goes the other way round).
+dnl
+dnl We work around this problem, if we encounter it.
+dnl
+dnl Usage: DEAL_II_CHECK_NESTED_NESTED_FRIEND_BUG
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_NESTED_NESTED_FRIEND_BUG, dnl
+[
+  AC_MSG_CHECKING(for nested nested classes friends bug)
+  AC_LANG(C++)
+  CXXFLAGS="$CXXFLAGSG"
+  AC_TRY_COMPILE(
+    [
+      class O {
+          class I {
+       class II {};
+          };
+          friend class I::II;
+      };
+    ],
+    [],
+    [
+      AC_MSG_RESULT(no)
+    ],
+    [
+      AC_MSG_RESULT(yes. using workaround)
+      AC_DEFINE(DEAL_II_NESTED_NESTED_FRIEND_BUG, 1, 
+                     [Defined if the compiler does not allow to make a class
+                      a friend to which we do not have access.])
+    ])
+])
+
+
+
 dnl -------------------------------------------------------------
 dnl Many compilers get this wrong (see Section 14.7.3.1, number (4)):
 dnl ---------------------------------
index 0fdd1ed590ce7c9985cd037d76021b3b90c9afac..c8ff524f384fdd3435a7308357ba2c9168d3ea0e 100644 (file)
@@ -174,6 +174,7 @@ 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_NESTED_CLASS_FRIEND_BUG
+DEAL_II_CHECK_NESTED_NESTED_FRIEND_BUG
 DEAL_II_CHECK_MEMBER_VAR_SPECIALIZATION_BUG
 DEAL_II_CHECK_LONG_DOUBLE_LOOP_BUG
 DEAL_II_CHECK_SFINAE_BUG
index 96ea314fe90c6b3358e99f06d5de808dd4fabd71..fa18ef9b391bf84d76f0df18b3fb43cda983f48e 100644 (file)
@@ -177,7 +177,7 @@ class SparseMatrixEZ : public Subscriptor
                                      */
     class const_iterator
     {
-      public:
+      private:
                                          /**
                                           * Accessor class for iterators
                                           */
@@ -299,7 +299,26 @@ class SparseMatrixEZ : public Subscriptor
                                           * Store an object of the
                                           * accessor class.
                                           */
-        Accessor accessor;        
+        Accessor accessor;
+
+                                        /**
+                                         * Make the enclosing class a
+                                         * friend. This is only
+                                         * necessary since icc7
+                                         * otherwise wouldn't allow
+                                         * us to make
+                                         * const_iterator::Accessor a
+                                         * friend, stating that it
+                                         * can't access this class --
+                                         * this is of course bogus,
+                                         * since granting friendship
+                                         * doesn't need access to the
+                                         * class being granted
+                                         * friendship...
+                                         */
+#ifdef DEAL_II_NESTED_NESTED_FRIEND_BUG        
+       template <typename> friend class SparseMatrixEZ;
+#endif
     };
     
                                     /**

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.