From: deal Date: Tue, 11 Mar 2003 15:37:50 +0000 (+0000) Subject: DEAL_II_CHECK_NESTED_NESTED_FRIEND_BUG X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7ba8d75f768bbbeeac2bc025c526ffb86ccc9b2f;p=dealii-svn.git DEAL_II_CHECK_NESTED_NESTED_FRIEND_BUG git-svn-id: https://svn.dealii.org/trunk@7315 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 4ce04fc925..feed3bc8bc 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -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 --------------------------------- diff --git a/deal.II/configure.in b/deal.II/configure.in index 0fdd1ed590..c8ff524f38 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -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 diff --git a/deal.II/lac/include/lac/sparse_matrix_ez.h b/deal.II/lac/include/lac/sparse_matrix_ez.h index 96ea314fe9..fa18ef9b39 100644 --- a/deal.II/lac/include/lac/sparse_matrix_ez.h +++ b/deal.II/lac/include/lac/sparse_matrix_ez.h @@ -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 friend class SparseMatrixEZ; +#endif }; /**