]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Check for a bug in Intel's icc compiler.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Apr 2002 11:48:06 +0000 (11:48 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Mon, 22 Apr 2002 11:48:06 +0000 (11:48 +0000)
git-svn-id: https://svn.dealii.org/trunk@5704 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/aclocal.m4
deal.II/configure.in

index 5181b26ff01b4a5a34a64b15382cbe4a37d54c23..3fbe698de80cb7b1aa48eb5ef7258654ecae9dcb 100644 (file)
@@ -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 <class Class> 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 <class Class> 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
index 11c6e671e6a69c961252a13c9242639fa0280afd..dde6080bfb0a1113d7e46152ec72a6355ca4e685 100644 (file)
@@ -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

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.