+dnl -------------------------------------------------------------
+dnl Some versions of gcc get this example wrong:
+dnl ---------------------------------
+dnl struct X
+dnl {
+dnl template <typename T> void operator << (T);
+dnl };
+dnl
+dnl void f()
+dnl {
+dnl X x;
+dnl x.operator << <double> (1);
+dnl }
+dnl ---------------------------------
+dnl They want to see a "template" for disambiguation in
+dnl x.template operator << <double> (1);
+dnl which shouldn't be necessary since the left hand side of the
+dnl dot operator is not template dependent. Surprisingly, this is
+dnl only the case for operators, not if operator<< were a regular
+dnl function. Annoyingly, other compilers barf on seeing the
+dnl disambiguating "template" keyword.
+dnl
+dnl Usage: DEAL_II_CHECK_TEMPL_OP_DISAMBIGUATION_BUG
+dnl
+dnl -------------------------------------------------------------
+AC_DEFUN(DEAL_II_CHECK_TEMPL_OP_DISAMBIGUATION_BUG, dnl
+[
+ AC_MSG_CHECKING(for template operator disambiguation bug)
+ AC_LANG(C++)
+ CXXFLAGS="$CXXFLAGSG"
+ AC_TRY_COMPILE(
+ [
+ struct X
+ {
+ template <typename T> void operator << (T);
+ };
+
+ void f()
+ {
+ X x;
+ x.operator << <double> (1);
+ }
+ ],
+ [],
+ [
+ AC_MSG_RESULT(no)
+ ],
+ [
+ AC_MSG_RESULT(yes. using workaround)
+ AC_DEFINE(DEAL_II_TEMPL_OP_DISAMBIGUATION_BUG, 1,
+ [Defined if the compiler requires the use of the
+ template keyword for disambiguation keyword in
+ certain contexts in which it is not supposed to
+ do so. For the exact failure mode, look at
+ aclocal.m4 in the top-level directory.])
+ ])
+])
+
+
+
dnl -------------------------------------------------------------
dnl The boost::shared_ptr class has a templated assignment operator
dnl but no assignment operator matching the default operator
the top-level directory. */
#undef DEAL_II_TEMPLATE_TEMPLATE_TYPEDEF_BUG
+/* Defined if the compiler requires the use of the template keyword for
+ disambiguation keyword in certain contexts in which it is not supposed to
+ do so. For the exact failure mode, look at aclocal.m4 in the top-level
+ directory. */
+#undef DEAL_II_TEMPL_OP_DISAMBIGUATION_BUG
+
/* 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
#! /bin/sh
-# From configure.in Revision: 1.159 .
+# From configure.in Revision: 1.160 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.57.
#
_ACEOF
+fi
+rm -f conftest.$ac_objext conftest.$ac_ext
+
+
+ echo "$as_me:$LINENO: checking for template operator disambiguation bug" >&5
+echo $ECHO_N "checking for template operator disambiguation 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. */
+
+ struct X
+ {
+ template <typename T> void operator << (T);
+ };
+
+ void f()
+ {
+ X x;
+ x.operator << <double> (1);
+ }
+
+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_TEMPL_OP_DISAMBIGUATION_BUG 1
+_ACEOF
+
+
fi
rm -f conftest.$ac_objext conftest.$ac_ext
DEAL_II_CHECK_ANON_NAMESPACE_BUG
DEAL_II_CHECK_ANON_NAMESPACE_BUG2
DEAL_II_CHECK_SFINAE_BUG
+DEAL_II_CHECK_TEMPL_OP_DISAMBIGUATION_BUG
DEAL_II_CHECK_ARRAY_CONDITIONAL_DECAY_BUG
DEAL_II_CHECK_BOOST_SHARED_PTR_ASSIGNMENT
DEAL_II_HAVE_PRETTY_FUNCTION
// common definitions used in all the tests
-
+#include <base/config.h>
#include <base/logstream.h>
#include <cmath>
const double d)
{
if (std::fabs (d) < 1e-10)
- logstream.operator << <double> (0.);
+ logstream.
+#ifdef DEAL_II_TEMPL_OP_DISAMBIGUATION_BUG
+ template
+#endif
+ operator << <double> (0.);
else
- logstream.operator << <double> (d);
+ logstream.
+#ifdef DEAL_II_TEMPL_OP_DISAMBIGUATION_BUG
+ template
+#endif
+ operator << <double> (d);
return logstream;
}
const float d)
{
if (std::fabs (d) < 1e-8)
- logstream.operator << <float> (0.);
+ logstream.
+#ifdef DEAL_II_TEMPL_OP_DISAMBIGUATION_BUG
+ template
+#endif
+ operator << <float> (0.);
else
- logstream.operator << <float> (d);
+ logstream.
+#ifdef DEAL_II_TEMPL_OP_DISAMBIGUATION_BUG
+ template
+#endif
+ operator << <float> (d);
return logstream;
}