diff options
author | 2009-12-18 17:08:59 +0100 | |
---|---|---|
committer | 2009-12-18 17:08:59 +0100 | |
commit | 9d5478303667bd97f3e20696f8a8c82cb5b2d65f (patch) | |
tree | c06b115886fac241916db3f20bc79d51cb38ce8f /Eigen/src/Core/util/XprHelper.h | |
parent | 945cbc3bc602e29298c9bc878e7f4c3f9e804ea4 (diff) |
much better workaround for empty struct (the previous one caused GCC 4.3 to generate wrong code leading to segfaults)
Diffstat (limited to 'Eigen/src/Core/util/XprHelper.h')
-rw-r--r-- | Eigen/src/Core/util/XprHelper.h | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/Eigen/src/Core/util/XprHelper.h b/Eigen/src/Core/util/XprHelper.h index 622c84a8e..2a9feaeeb 100644 --- a/Eigen/src/Core/util/XprHelper.h +++ b/Eigen/src/Core/util/XprHelper.h @@ -28,16 +28,11 @@ // just a workaround because GCC seems to not really like empty structs #ifdef __GNUG__ - struct ei_empty_struct - { - EIGEN_ALWAYS_INLINE_ATTRIB ei_empty_struct() {} - EIGEN_ALWAYS_INLINE_ATTRIB ei_empty_struct(const ei_empty_struct&) {} - EIGEN_ALWAYS_INLINE_ATTRIB ei_empty_struct& operator=(const ei_empty_struct&) { return *this; } - char _ei_dummy_; - }; - #define EIGEN_EMPTY_STRUCT : Eigen::ei_empty_struct + #define EIGEN_EMPTY_STRUCT_CTOR(X) \ + EIGEN_STRONG_INLINE X() {} \ + EIGEN_STRONG_INLINE X(const X&) {} #else - #define EIGEN_EMPTY_STRUCT + #define EIGEN_EMPTY_STRUCT_CTOR(X) #endif //classes inheriting ei_no_assignment_operator don't generate a default operator=. @@ -51,10 +46,10 @@ class ei_no_assignment_operator * can be accessed using value() and setValue(). * Otherwise, this class is an empty structure and value() just returns the template parameter Value. */ -template<int Value> class ei_int_if_dynamic EIGEN_EMPTY_STRUCT +template<int Value> class ei_int_if_dynamic { public: - ei_int_if_dynamic() {} + EIGEN_EMPTY_STRUCT_CTOR(ei_int_if_dynamic) explicit ei_int_if_dynamic(int) {} static int value() { return Value; } void setValue(int) {} |