aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/dynalloc.cpp
diff options
context:
space:
mode:
authorGravatar Gael Guennebaud <g.gael@free.fr>2014-07-30 09:32:35 +0200
committerGravatar Gael Guennebaud <g.gael@free.fr>2014-07-30 09:32:35 +0200
commitba694ce8cff79521850eee3285606589925880a5 (patch)
tree79306df42eeb4ac578776da43e58025c8554b113 /test/dynalloc.cpp
parent5f3d542b8a526d2fb8a179eb68f4a6d35f4f85a3 (diff)
add missing delete operator overloads
Diffstat (limited to 'test/dynalloc.cpp')
-rw-r--r--test/dynalloc.cpp31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/dynalloc.cpp b/test/dynalloc.cpp
index c98cc80f0..4f53ea6f0 100644
--- a/test/dynalloc.cpp
+++ b/test/dynalloc.cpp
@@ -93,6 +93,32 @@ template<typename T> void check_dynaligned()
}
}
+template<typename T> void check_custom_new_delete()
+{
+ {
+ T* t = new T;
+ delete t;
+ }
+
+ {
+ std::size_t N = internal::random<std::size_t>(1,10);
+ T* t = new T[N];
+ delete[] t;
+ }
+
+#ifdef EIGEN_ALIGN
+ {
+ T* t = static_cast<T *>((T::operator new)(sizeof(T)));
+ (T::operator delete)(t, sizeof(T));
+ }
+
+ {
+ T* t = static_cast<T *>((T::operator new)(sizeof(T)));
+ (T::operator delete)(t);
+ }
+#endif
+}
+
void test_dynalloc()
{
// low level dynamic memory allocation
@@ -109,6 +135,11 @@ void test_dynalloc()
CALL_SUBTEST(check_dynaligned<Vector4d>() );
CALL_SUBTEST(check_dynaligned<Vector4i>() );
CALL_SUBTEST(check_dynaligned<Vector8f>() );
+
+ CALL_SUBTEST( check_custom_new_delete<Vector4f>() );
+ CALL_SUBTEST( check_custom_new_delete<Vector2f>() );
+ CALL_SUBTEST( check_custom_new_delete<Matrix4f>() );
+ CALL_SUBTEST( check_custom_new_delete<MatrixXi>() );
}
// check static allocation, who knows ?