aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/unalignedassert.cpp
diff options
context:
space:
mode:
authorGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-06 03:16:50 +0000
committerGravatar Benoit Jacob <jacob.benoit.1@gmail.com>2009-01-06 03:16:50 +0000
commit1c29d703123f876d75885a03b10c5deb3d36813f (patch)
tree72a4a68207e5cd25c5829e5655ff78c9e8d12b1d /test/unalignedassert.cpp
parente71de20f1667e9e10dc315108a34550fb3226270 (diff)
* introduce macros to replace inheritance for operator new overloading
(former solution still available and tested) This plays much better with classes that already have base classes -- don't force the user to mess with multiple inheritance, which gave much trouble with MSVC. * Expand the unaligned assert dox page * Minor fixes in the lazy evaluation dox page
Diffstat (limited to 'test/unalignedassert.cpp')
-rw-r--r--test/unalignedassert.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/test/unalignedassert.cpp b/test/unalignedassert.cpp
index 0b5bf0c77..2d0b5a015 100644
--- a/test/unalignedassert.cpp
+++ b/test/unalignedassert.cpp
@@ -61,8 +61,9 @@ struct Good7 : Eigen::WithAlignedOperatorNew
float f; // make the struct have sizeof%16!=0 to make it a little more tricky when we allow an array of 2 such objects
};
-struct Good8 : Eigen::WithAlignedOperatorNew
+struct Good8
{
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW
float f; // try the f at first -- the EIGEN_ALIGN_128 attribute of m should make that still work
Matrix4f m;
};
@@ -73,6 +74,13 @@ struct Good9
float f;
};
+template<bool Align> struct Depends
+{
+ EIGEN_MAKE_ALIGNED_OPERATOR_NEW_IF(Align)
+ Vector2d m;
+ float f;
+};
+
template<typename T>
void check_unalignedassert_good()
{
@@ -104,6 +112,8 @@ void unalignedassert()
check_unalignedassert_good<Good7>();
check_unalignedassert_good<Good8>();
check_unalignedassert_good<Good9>();
+ check_unalignedassert_good<Depends<true> >();
+ VERIFY_RAISES_ASSERT(check_unalignedassert_bad<Depends<false> >());
}
void test_unalignedassert()