From: wolf Date: Mon, 22 Apr 2002 11:48:06 +0000 (+0000) Subject: Check for a bug in Intel's icc compiler. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=346cb59f499d16516e7c66eb5ac0222a643981dd;p=dealii-svn.git Check for a bug in Intel's icc compiler. git-svn-id: https://svn.dealii.org/trunk@5704 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/aclocal.m4 b/deal.II/aclocal.m4 index 5181b26ff0..3fbe698de8 100644 --- a/deal.II/aclocal.m4 +++ b/deal.II/aclocal.m4 @@ -1453,7 +1453,7 @@ dnl construct at various places, we check for it and if the compiler dnl dies, we use a workaround that is non-ISO C++ but works for these dnl compilers. dnl -dnl Usage: DEAL_II_NAMESP_TEMPL_FRIEND_BUG +dnl Usage: DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG dnl dnl ------------------------------------------------------------- AC_DEFUN(DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG, dnl @@ -1496,6 +1496,63 @@ AC_DEFUN(DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG, dnl +dnl ------------------------------------------------------------- +dnl Intel's ICC 5.0.1 compiler has the following problem: it won't +dnl compile this code: +dnl --------------------------------- +dnl template void encapsulate (void (Class::*fun_ptr)()); +dnl struct X { +dnl void bar () const; +dnl }; +dnl void foo () { +dnl encapsulate(&X::bar); +dnl }; +dnl --------------------------------- +dnl It complains about not finding an instance for the encapsulate function. +dnl The problem is due to the fact that the function we take the address of +dnl is constant, i.e. it should match the template with Class="const X", +dnl but apparently doesn't. Unfortunately, we rely on such code in the +dnl Threads mechanisms. So detect this bug and if present work around it +dnl by providing a second set of encapsulate functions for constant +dnl functions. +dnl +dnl Usage: DEAL_II_CHECK_TEMPL_CONST_MEM_PTR_BUG +dnl +dnl ------------------------------------------------------------- +AC_DEFUN(DEAL_II_CHECK_TEMPL_CONST_MEM_PTR_BUG, dnl +[ + AC_MSG_CHECKING(for templates and pointers to const member functions bug) + AC_LANG(C++) + CXXFLAGS="$CXXFLAGSG" + AC_TRY_COMPILE( + [ + template void encapsulate (void (Class::*fun_ptr)()); + + struct X { + void bar () const; + }; + + void foo () { + encapsulate(&X::bar); + }; + ], + [], + [ + AC_MSG_RESULT(no) + ], + [ + AC_MSG_RESULT(yes. using workaround) + AC_DEFINE(DEAL_II_TEMPL_CONST_MEM_PTR_BUG, 1, + [Define if we have to work around a bug in icc in which + the compiler refuses to consider a template when given + a pointer to a constant member function. + See the aclocal.m4 file in the top-level directory + for a description of this bug.]) + ]) +]) + + + dnl ------------------------------------------------------------- dnl gcc2.95 doesn't have the std::iterator class, but the standard diff --git a/deal.II/configure.in b/deal.II/configure.in index 11c6e671e6..dde6080bfb 100644 --- a/deal.II/configure.in +++ b/deal.II/configure.in @@ -155,6 +155,7 @@ DEAL_II_CHECK_LOCAL_TYPEDEF_COMP DEAL_II_CHECK_TEMPLATE_SPEC_ACCESS DEAL_II_CHECK_MEMBER_OP_TEMPLATE_INST DEAL_II_CHECK_NAMESP_TEMPL_FRIEND_BUG +DEAL_II_CHECK_TEMPL_CONST_MEM_PTR_BUG DEAL_II_HAVE_STD_ITERATOR DEAL_II_HAVE_STD_STRINGSTREAM DEAL_II_HAVE_STD_NUMERIC_LIMITS