+dnl -------------------------------------------------------------
+dnl In some cases, we would like to name partial specializations
+dnl as friends. However, the standard forbids us to do so. But
+dnl then, we can declare the general template as a friend, and
+dnl at least gcc extends the friendship to all specializations
+dnl of the templates, which is not what the standard says.
+dnl
+dnl With other compilers, most notably cxx, this does not work.
+dnl In this case, we can make individual specializations friends,
+dnl which in turn gcc rejects. So check, whether this is possible.
+dnl
+dnl The respective clause in the standard is 14.5.3.1, which gives
+dnl this example:
+dnl template<class T> class task {
+dnl friend class task<int>;
+dnl };
+dnl
+dnl
+dnl Usage: DEAL_II_CHECK_TEMPL_SPEC_FRIEND_BUG
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_TEMPL_SPEC_FRIEND_BUG, dnl
+[
+ AC_MSG_CHECKING(for template specialization friend bug)
+ AC_LANG(C++)
+ CXXFLAGS="$CXXFLAGSG"
+ AC_TRY_COMPILE(
+ [
+template <int N, typename T> class X;
+template <typename T> class X<1,T>;
+
+template <typename P> class Y {
+ static int i;
+ template <int N, typename T> friend class X;
+ friend class X<1,P>;
+};
+
+template <typename T> class X<1,T> {
+ X () { Y<T>::i; }; // access private field
+};
+
+template class X<1,int>;
+ ],
+ [],
+ [
+ AC_MSG_RESULT(no)
+ ],
+ [
+ AC_MSG_RESULT(yes)
+ AC_DEFINE_UNQUOTED(DEAL_II_TEMPL_SPEC_FRIEND_BUG, 1,
+ [Define if we have to work around a bug with some
+ compilers that will not allow us to specify a
+ fully specialized class of a template as a friend.
+ See the aclocal.m4 file in the top-level directory
+ for a description of this bug.])
+ ])
+])
+
+
+
dnl -------------------------------------------------------------
dnl Intel's ICC 5.0.1 compiler has the following problem: it won't
dnl compile this code:
template <int N1, typename T1> friend class Table;
template <int N1, typename T1, bool C1, unsigned int P1>
friend class Accessor;
-#else
+# ifndef DEAL_II_TEMPL_SPEC_FRIEND_BUG
+ friend class Table<N,T>;
friend class Accessor<N,T,C,P+1>;
+# endif
+#else
friend class Table<N,T>;
+ friend class Accessor<N,T,C,P+1>;
#endif
};
#! /bin/sh
-# From configure.in Revision: 1.122 .
+# From configure.in Revision: 1.123 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53a.
#
_ACEOF
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+ echo "$as_me:$LINENO: checking for template specialization friend bug" >&5
+echo $ECHO_N "checking for template specialization friend 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"
+#include "confdefs.h"
+
+template <int N, typename T> class X;
+template <typename T> class X<1,T>;
+
+template <typename P> class Y {
+ static int i;
+ template <int N, typename T> friend class X;
+ friend class X<1,P>;
+};
+
+template <typename T> class X<1,T> {
+ X () { Y<T>::i; }; // access private field
+};
+
+template class X<1,int>;
+
+#ifdef F77_DUMMY_MAIN
+# ifdef __cplusplus
+ extern "C"
+# endif
+ int F77_DUMMY_MAIN() { return 1; }
+#endif
+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
+cat conftest.$ac_ext >&5
+
+ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6
+
+cat >>confdefs.h <<_ACEOF
+#define DEAL_II_TEMPL_SPEC_FRIEND_BUG 1
+_ACEOF
+
+
fi
rm -f conftest.$ac_objext conftest.$ac_ext
DEAL_II_CHECK_TEMPLATE_SPEC_ACCESS
DEAL_II_CHECK_MEMBER_OP_TEMPLATE_INST
DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG
+DEAL_II_CHECK_TEMPL_SPEC_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