diff --git a/Eigen/src/Core/Matrix.h b/Eigen/src/Core/Matrix.h index d16cae031..893b765ef 100644 --- a/Eigen/src/Core/Matrix.h +++ b/Eigen/src/Core/Matrix.h @@ -25,6 +25,8 @@ #ifndef EIGEN_MATRIX_H #define EIGEN_MATRIX_H +struct ei_select_matrix_constructor_doing_absolutely_nothing {}; + /** \class Matrix * * \brief The matrix class, also used for vectors and row-vectors @@ -131,6 +133,8 @@ class Matrix protected: ei_matrix_storage m_storage; + Matrix(ei_select_matrix_constructor_doing_absolutely_nothing) // this ctor does not even do an assertion + : m_storage(ei_select_matrix_storage_constructor_doing_absolutely_nothing) {} public: enum { NeedsToAlign = (Options&AutoAlign) == AutoAlign diff --git a/Eigen/src/Core/MatrixStorage.h b/Eigen/src/Core/MatrixStorage.h index 9806dc6b2..b02c47a60 100644 --- a/Eigen/src/Core/MatrixStorage.h +++ b/Eigen/src/Core/MatrixStorage.h @@ -26,6 +26,9 @@ #ifndef EIGEN_MATRIXSTORAGE_H #define EIGEN_MATRIXSTORAGE_H +struct ei_select_matrix_storage_constructor_doing_absolutely_nothing {}; +struct ei_select_matrix_array_constructor_doing_absolutely_nothing {}; + /** \internal * Static array automatically aligned if the total byte size is a multiple of 16 and the matrix options require auto alignment */ @@ -42,6 +45,8 @@ template struct ei_matrix_array @@ -68,6 +73,8 @@ template class ei_matr ei_matrix_array m_data; public: inline explicit ei_matrix_storage() {} + inline ei_matrix_storage(ei_select_matrix_storage_constructor_doing_absolutely_nothing) + : m_data(ei_select_matrix_array_constructor_doing_absolutely_nothing) {} inline ei_matrix_storage(int,int,int) {} inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); } inline static int rows(void) {return _Rows;} @@ -85,6 +92,8 @@ template class ei_matrix_storage class ei_matrix_storage< int m_rows; public: inline explicit ei_matrix_storage() : m_rows(0) {} + inline ei_matrix_storage(ei_select_matrix_storage_constructor_doing_absolutely_nothing) + : m_data(ei_select_matrix_array_constructor_doing_absolutely_nothing) {} inline ei_matrix_storage(int, int rows, int) : m_rows(rows) {} inline ~ei_matrix_storage() {} inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } @@ -127,6 +138,8 @@ template class ei_matrix_storage< int m_cols; public: inline explicit ei_matrix_storage() : m_cols(0) {} + inline ei_matrix_storage(ei_select_matrix_storage_constructor_doing_absolutely_nothing) + : m_data(ei_select_matrix_array_constructor_doing_absolutely_nothing) {} inline ei_matrix_storage(int, int, int cols) : m_cols(cols) {} inline ~ei_matrix_storage() {} inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } @@ -148,6 +161,8 @@ template class ei_matrix_storage(size)), m_rows(rows), m_cols(cols) {} inline ~ei_matrix_storage() { ei_aligned_delete(m_data, m_rows*m_cols); } @@ -176,6 +191,8 @@ template class ei_matrix_storage(size)), m_cols(cols) {} inline ~ei_matrix_storage() { ei_aligned_delete(m_data, _Rows*m_cols); } inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_cols,other.m_cols); } @@ -201,6 +218,8 @@ template class ei_matrix_storage(size)), m_rows(rows) {} inline ~ei_matrix_storage() { ei_aligned_delete(m_data, _Cols*m_rows); } inline void swap(ei_matrix_storage& other) { std::swap(m_data,other.m_data); std::swap(m_rows,other.m_rows); } diff --git a/Eigen/src/Core/util/Memory.h b/Eigen/src/Core/util/Memory.h index 4a60da58b..e833d4294 100644 --- a/Eigen/src/Core/util/Memory.h +++ b/Eigen/src/Core/util/Memory.h @@ -293,8 +293,8 @@ inline static int ei_alignmentOffset(const Scalar* ptr, int maxOffset) void *operator new[](size_t size) throw() { \ return Eigen::ei_conditional_aligned_malloc(size); \ } \ - void operator delete(void * ptr) { Eigen::ei_aligned_free(ptr); } \ - void operator delete[](void * ptr) { Eigen::ei_aligned_free(ptr); } \ + void operator delete(void * ptr) { Eigen::ei_conditinal_aligned_free(ptr); } \ + void operator delete[](void * ptr) { Eigen::ei_conditinal_aligned_free(ptr); } \ EIGEN_WORKAROUND_FOR_QT_BUG_CALLING_WRONG_OPERATOR_NEW #define EIGEN_MAKE_ALIGNED_OPERATOR_NEW EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(true)