aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2013-01-23 20:51:38 +0100
committerGravatar Gael Guennebaud <g.gael@free.fr>2013-01-23 20:51:38 +0100
commitc22f7cef83cedb1ed445bb309cc07db58303f4cb (patch)
treea02bfa6133b9dad5d0108b17ca8c0973acff051d
parent73026eab4d7df4e61f954c00f5793bc077fd3f2f (diff)
Workaround "error: floating-point literal cannot appear in a constant-expression" in mpreal.h when compiling with predantic.
(I really don't know how to properly fix this))
-rw-r--r--Eigen/src/Core/util/Macros.h6
-rw-r--r--unsupported/test/mpreal/mpreal.h4
2 files changed, 8 insertions, 2 deletions
diff --git a/Eigen/src/Core/util/Macros.h b/Eigen/src/Core/util/Macros.h
index 1bbd24b8b..933a34c9d 100644
--- a/Eigen/src/Core/util/Macros.h
+++ b/Eigen/src/Core/util/Macros.h
@@ -145,6 +145,12 @@
#define EIGEN_DONT_INLINE
#endif
+#if (defined __GNUC__)
+#define EIGEN_PERMISSIVE_EXPR __extension__
+#else
+#define EIGEN_PERMISSIVE_EXPR
+#endif
+
// this macro allows to get rid of linking errors about multiply defined functions.
// - static is not very good because it prevents definitions from different object files to be merged.
// So static causes the resulting linked executable to be bloated with multiple copies of the same function.
diff --git a/unsupported/test/mpreal/mpreal.h b/unsupported/test/mpreal/mpreal.h
index 5eeedd92d..38946c3bd 100644
--- a/unsupported/test/mpreal/mpreal.h
+++ b/unsupported/test/mpreal/mpreal.h
@@ -3233,8 +3233,8 @@ namespace std
// Please note, exponent range is not fixed in MPFR
static const int min_exponent = MPFR_EMIN_DEFAULT;
static const int max_exponent = MPFR_EMAX_DEFAULT;
- static const int min_exponent10 = (int) (MPFR_EMIN_DEFAULT * 0.3010299956639811);
- static const int max_exponent10 = (int) (MPFR_EMAX_DEFAULT * 0.3010299956639811);
+ EIGEN_PERMISSIVE_EXPR static const int min_exponent10 = (int) (MPFR_EMIN_DEFAULT * 0.3010299956639811);
+ EIGEN_PERMISSIVE_EXPR static const int max_exponent10 = (int) (MPFR_EMAX_DEFAULT * 0.3010299956639811);
// Should be constant according to standard, but 'digits' depends on precision in MPFR