diff liboctave/oct-inttypes.h @ 8856:ab4db66e286f

workaround gcc 4.3 explicit instantiation bug in octave_int_cmp_op
author Jaroslav Hajek <highegg@gmail.com>
date Tue, 24 Feb 2009 11:15:05 +0100
parents 5abe5ae55465
children eb63fbe60fab
line wrap: on
line diff
--- a/liboctave/oct-inttypes.h	Tue Feb 24 11:12:38 2009 +0100
+++ b/liboctave/oct-inttypes.h	Tue Feb 24 11:15:05 2009 +0100
@@ -192,20 +192,29 @@
       return xop::op (static_cast<long double> (x), \
                       static_cast<long double> (y)); \
     }
+#else 
+  // ... otherwise, use external handlers
+
+  // FIXME: We could declare directly the mop methods as external,
+  // but we can't do this because bugs in gcc (<= 4.3) prevent
+  // explicit instantiations later in that case.
+#define DEFINE_LONG_DOUBLE_CMP_OP(T1, T2) \
+  template <class xop> static OCTAVE_API bool \
+  emulate_mop (T1, T2); \
+  template <class xop> \
+  static bool \
+  mop (T1 x, T2 y) \
+    { \
+      return emulate_mop<xop> (x, y); \
+    }
+#endif
+
   DEFINE_LONG_DOUBLE_CMP_OP(double, uint64_t)
   DEFINE_LONG_DOUBLE_CMP_OP(double, int64_t)
   DEFINE_LONG_DOUBLE_CMP_OP(int64_t, double)
   DEFINE_LONG_DOUBLE_CMP_OP(uint64_t, double)
+
 #undef DEFINE_LONG_DOUBLE_CMP_OP
-
-#else
-  // ... otherwise, use external handlers
-  template <class xop> static OCTAVE_API bool mop (uint64_t, double);
-  template <class xop> static OCTAVE_API bool mop (int64_t, double);
-  template <class xop> static OCTAVE_API bool mop (double, uint64_t);
-  template <class xop> static OCTAVE_API bool mop (double, int64_t);
-#endif
-
 };
 
 // Base integer class. No data, just conversion methods and exception flags.